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

Conda-installed cython does not work (MSVC issues) #2449

Closed
jennirinker opened this issue Jun 21, 2017 · 8 comments
Closed

Conda-installed cython does not work (MSVC issues) #2449

jennirinker opened this issue Jun 21, 2017 · 8 comments

Comments

@jennirinker
Copy link

Steps to reproduce:

  1. Install miniconda 64-bit, Python 3.6 on Windows 7
  2. Update conda, then conda install cython
  3. Attempt to compile basic helloworld tutorial with python setup.py build_ext --inplace
  4. Command fails with infamous "error: Unable to find vcvarsall.bat"

I know this is related to the Visual Studio C compilers. My version of python was compiled using MSC v.1900 (Visual Studio 2015, a.k.a. v14), but I don't have VS 2015 installed and I don't want to install proprietary software. This page notes that VS 2015 has a "full-featured community edition", but that link now leads to VS 2017. And if you install the toolchains for MS 2017, you have vcvarsall.bat and cl.exe and all the functions that are required to run Cython, but I think msvc9compiler.py doesn't look in the correct places (probably because it's VS 2017).

Any advice on getting Cython to run on Windows with VS 2017 is appreciated.

@mingwandroid
Copy link

mingwandroid commented Jun 21, 2017

I don't want to install proprietary software.
if you install the toolchains for MS 2017, you have vcvarsall.bat and cl.exe and all the functions that are required to run Cython, but I think msvc9compiler.py doesn't look in the correct places (probably because it's VS 2017).

'Free' here does not mean 'not proprietary'. A term commonly used to explain this is "free as in beer not as in free speech."

If you want to use cython avoiding as much proprietary software as possible (on Windows) you can achieve that from the Anaconda Prompt with the following:

conda install libpython m2w64-toolchain cython
echo [build] > %CONDA_PREFIX%\Lib\distutils\distutils.cfg
echo compiler = mingw32 >> %CONDA_PREFIX%\Lib\distutils\distutils.cfg

If you are just trying to avoid paying for Visual Studio 2015 then you should be able to use this link: http://landinghub.visualstudio.com/visual-cpp-build-tools

@jennirinker
Copy link
Author

Touche. I know the difference between free and proprietary, and I should have been more accurate in my statement.

Also, you are a wonderful human being. After days messing around with different compiler installations, your link to the visual cpp build tools has fixed my issue with Cython. Thank you so much.

Since Cython now works for me, I'm going to close the issue.

@tritemio
Copy link

tritemio commented Aug 7, 2018

The link above does not work anymore. What is the current suggested link to install the free-as-in-beer MS compiler on windows 7+ to be used with current Anaconda?

ping @mingwandroid

@mingwandroid
Copy link

Full blown Visual Studio is free as in beer for many uses.

@tritemio
Copy link

tritemio commented Aug 7, 2018

It's maybe just me, but I can't find the link to Visual Studio 2015 community.

EDIT: I probably found it after creating a MS account and joining the DevEssential program (whatever that means):

screen shot 2018-08-07 at 11 37 49 am

@mingwandroid
Copy link

VS2017 might work ok-ish.

@mingwandroid
Copy link

.. for Python 3.7 and C stuff I expect it will anyway.

@jennirinker
Copy link
Author

@tritemio We made a repo/documentation set with detailed instructions for setting up compilers on Windows (both f2py and cython). Got tired of re-inventing the wheel.

Documentation: https://python-at-risoe.pages.windenergy.dtu.dk/compiling-on-windows/
Repo: https://gitlab.windenergy.dtu.dk/python-at-risoe/compiling-on-windows

Sorry the repo is on GitLab -- organizational decisions above my head.

Hopefully it works for you.

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

No branches or pull requests

3 participants