Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pycompilation if installed. #108

Closed
wants to merge 11 commits into from
Closed

Conversation

moorepants
Copy link
Member

Currently have this error:

File ~/src/opty/opty/utils.py:477, in ufuncify_matrix(args, expr, const, tmp_dir, parallel)
    474     if parallel:
    475         options += ['openmp']
--> 477     cython_module = pycompilation.compile_link_import_strings(
    478         sources, options=options, std='c99', logger=True,
    479         include_dirs=[np.get_include()], build_dir=codedir)
    480 else:
    481     workingdir = os.getcwd()

File ~/miniconda/envs/muscle-bike-paper/lib/python3.11/site-packages/pycompilation/compilation.py:717, in compile_link_import_strings(codes, build_dir, **kwargs)
    714                 ofh_md5.write(md5_in_mem)
    715     source_files.append(dest)
--> 717 return compile_link_import_py_ext(
    718     source_files, build_dir=build_dir, **kwargs)

File ~/miniconda/envs/muscle-bike-paper/lib/python3.11/site-packages/pycompilation/compilation.py:666, in compile_link_import_py_ext(srcs, extname, build_dir, compile_kwargs, link_kwargs, **kwargs)
    664     mod = import_module_from_file(os.path.join(build_dir, extname), srcs)
    665 except ImportError:
--> 666     objs = compile_sources(list(map(get_abspath, srcs)), destdir=build_dir,
    667                            cwd=build_dir, **compile_kwargs)
    668     so = link_py_so(
    669         objs, cwd=build_dir, fort=any_fort(srcs), cplus=any_cplus(srcs),
    670         **link_kwargs)
    671     mod = import_module_from_file(so)

File ~/miniconda/envs/muscle-bike-paper/lib/python3.11/site-packages/pycompilation/compilation.py:149, in compile_sources(files, CompilerRunner_, destdir, cwd, keep_dir_struct, per_file_kwargs, **kwargs)
    147     file_kwargs = kwargs.copy()
    148     file_kwargs.update(_per_file_kwargs.get(f, {}))
--> 149     dstpaths.append(src2obj(
    150         f, CompilerRunner_, cwd=cwd,
    151         **file_kwargs
    152     ))
    153 return dstpaths

File ~/miniconda/envs/muscle-bike-paper/lib/python3.11/site-packages/pycompilation/compilation.py:449, in src2obj(srcpath, CompilerRunner_, objpath, only_update, cwd, out_ext, inc_py, **kwargs)
    444     return pyx2obj(srcpath, objpath=objpath,
    445                    include_dirs=include_dirs, cwd=cwd,
    446                    only_update=only_update, **kwargs)
    448 if CompilerRunner_ is None:
--> 449     CompilerRunner_, std = extension_mapping[ext.lower()]
    450     if 'std' not in kwargs:
    451         kwargs['std'] = std

KeyError: '.h'
> /home/moorepants/miniconda/envs/muscle-bike-paper/lib/python3.11/site-packages/pycompilation/compilation.py(449)src2obj()
    447 
    448     if CompilerRunner_ is None:
--> 449         CompilerRunner_, std = extension_mapping[ext.lower()]
    450         if 'std' not in kwargs:
    451             kwargs['std'] = std

@moorepants
Copy link
Member Author

Closing in favor of #109.

@moorepants moorepants closed this Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants