1

"C:\Users\Sameer Khanna\Anaconda3\python.exe" "C:/Users/Sameer Khanna/Desktop/NPann-dce_wrist-db62618c97ac/ex_process_dce_roiwise.py" Traceback (most recent call last): File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 209, in load_module inplace=build_inplace, language_level=language_level) File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 186, in build_module reload_support=pyxargs.reload_support) File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\pyximport\pyxbuild.py", line 100, in pyx_to_dll dist.run_commands() File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\Cython\Distutils\build_ext.py", line 164, in run _build_ext.build_ext.run(self) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils\command\build_ext.py", line 338, in run self.build_extensions() File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\Cython\Distutils\build_ext.py", line 172, in build_extensions self.build_extension(ext) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils\command\build_ext.py", line 532, in build_extension depends=ext.depends) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils_msvccompiler.py", line 315, in compile self.initialize() File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils_msvccompiler.py", line 208, in initialize vc_env = _get_vc_env(plat_spec) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils_msvccompiler.py", line 81, in _get_vc_env vcvarsall, vcruntime = _find_vcvarsall(plat_spec) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils_msvccompiler.py", line 34, in _find_vcvarsall access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/Sameer Khanna/Desktop/NPann-dce_wrist-db62618c97ac/ex_process_dce_roiwise.py", line 7, in from compartmentmodels.compartmentmodels import TwoCXModel, TwoCUModel, CompartmentModel, ModifiedTofts File "C:\Users\Sameer Khanna\Desktop\NPann-dce_wrist-db62618c97ac\compartmentmodels\compartmentmodels.py", line 13, in from . import c_convolution_exp File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 435, in load_module language_level=self.language_level) File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 225, in load_module raise exc.with_traceback(tb) File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 209, in load_module inplace=build_inplace, language_level=language_level) File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 186, in build_module reload_support=pyxargs.reload_support) File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\pyximport\pyxbuild.py", line 100, in pyx_to_dll dist.run_commands() File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\Cython\Distutils\build_ext.py", line 164, in run _build_ext.build_ext.run(self) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils\command\build_ext.py", line 338, in run self.build_extensions() File "C:\Users\Sameer Khanna\Anaconda3\lib\site-packages\Cython\Distutils\build_ext.py", line 172, in build_extensions self.build_extension(ext) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils\command\build_ext.py", line 532, in build_extension depends=ext.depends) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils_msvccompiler.py", line 315, in compile self.initialize() File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils_msvccompiler.py", line 208, in initialize vc_env = _get_vc_env(plat_spec) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils_msvccompiler.py", line 81, in _get_vc_env vcvarsall, vcruntime = _find_vcvarsall(plat_spec) File "C:\Users\Sameer Khanna\Anaconda3\lib\distutils_msvccompiler.py", line 34, in _find_vcvarsall access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY ImportError: Building module compartmentmodels.c_convolution_exp failed: ['FileNotFoundError: [WinError 2] The system cannot find the file specified\n']

Process finished with exit code 1

I get the above error message when trying to use pyximport on Windows. I am also unable to go through the Cython tutorial, being unable to perform the setup.py and pyximport methods.

I downloaded PyCharm and Anaconda 3.5

What am I doing wrong?

angelcool.net
  • 2,505
  • 1
  • 24
  • 26

1 Answers1

3

Are you sure that the .pyx file location is in your current directory or PYTHONPATH?

E.g., try to create a file helloworld.pyx with the following contents:

cimport cython
cpdef hello_world():
    return 'Hello, World'

save it in the directory from which you started your python interpreter.

and run

>>> import pyximport; pyximport.install()
>>> import helloworld
>>> helloworld.hello_world()
'Hello, World'

Alternatively, you can save helloworld.pyx somewhere else and add this directory to your PYTHONPATH, e.g.,

>>> import sys
>>> sys.path.insert(0, '/Users/Sebastian/Desktop')
  • Yes, I even tried adding it to the path in the way that you suggested. Same error: ImportError: Building module hello failed: ['FileNotFoundError: [WinError 2] The system cannot find the file specified\n'] – SAMEER TAJDIN KHANNA Nov 08 '15 at 22:03
  • Hm, it seems like you have a compiler issue then. Maybe you have installed some stuff via pip rather than conda? –  Nov 09 '15 at 01:18
  • Ah, before I post a lengthy comment, maybe this will help you out: http://stackoverflow.com/questions/3297254/how-to-use-mingws-gcc-compiler-when-installing-python-package-using-pip –  Nov 09 '15 at 01:18
  • I only installed pycharm and anaconda 3.5 – SAMEER TAJDIN KHANNA Nov 09 '15 at 19:02
  • Are you running this via PyCharm? If yes, please try to run the same code from the command line -- I bet it will work then. –  Nov 09 '15 at 20:30
  • Finally got past that problem, but now I have another issue. Now I get a TypeError: unorderable types: NoneType() >= str()\n – SAMEER TAJDIN KHANNA Nov 10 '15 at 02:11
  • Glad to hear that it finally worked out for you. The "new" issue sounds like you haven't declared your variables correctly –  Nov 10 '15 at 03:24
  • I running the cython tutorial. Nothing else. – SAMEER TAJDIN KHANNA Nov 10 '15 at 04:50
  • Maybe you could post this issue with the variable declaration / types as a separate question or update your original question including the actual code you are trying to run –  Nov 10 '15 at 05:10