Cannot Install Python Modules after Installing Anaconda

10,718

Solution 1

You could try to find someone who's built this package on binstar, which is the package hosting site for Anaconda.

I found https://binstar.org/dhirschfeld/pyodbc/3.0.7/files, which may work for you if you have 64-bit Windows. You can try conda install -c https://conda.binstar.org/dhirschfeld pyodbc.

Solution 2

It looks like you've downloaded the source for PyODBC and it contains some code that needs to be compiled (C/C++). Your error refers to the fact that you don't have gcc (a compiler) installed.

You can either install mingw32 or gcc (through cygwin) to build and install the module, but the easiest thing to do is probably just download the ODBC Windows installer from their Google Code site.

Solution 3

Your problem is that you do not have a C compiler (gcc is a C compiler), which is needed in order for the package you downloaded to be installed. This problem is completely independent of Anaconda.

Your options are:

  • Install a C compiler, and then build the package sources you downloaded (via the python setup.py install command)
  • Find a pre-compiled version of the package.

You did not say what platform you are on. I suspect you are on a Mac or on Windows, since most Linux installations have a working C compiler.

If you are on a Mac, please install Xcode via the App Store. This is the overall recommended way to get a C compiler on Mac OS X.

If you are on Windows, you should install the MinGW package via:

conda install mingw

Then you can try doing "python setup.py install".

BTW, the difficulties you are encountering with building packages is common, and it's why people use a distribution like Anaconda, instead of struggling with build issues on their own. If you want to only use Anaconda part of the time, and use your system Python, then you can just set your PATH variable by editing ~/.bash_profile and commenting out the line at the very bottom which adds anaconda/bin/ to your path.

Managing packages across two different Python installations is going to cause you more headaches than it's generally worth. I would recommend just using Anaconda, unless you have a very good reason to stick with the system Python.

Share:
10,718
user1893148
Author by

user1893148

Updated on June 04, 2022

Comments

  • user1893148
    user1893148 almost 2 years

    [New Note: I cannot install through binstar or anaconda. Why can't I install in python, outside of anaconda? Is there a way to get my computer to stop using the anaconda install of python when I don't luanch it specifically through the continuum launcher?]

    I have an install of Python 2.7 on a windows machine. I just recently installed Anaconda, in addition.

    I just tried to install a new module for my Python install. I opened a command prompt in an unzipped folder for a python module and ran:

    python setup.py install

    However, I experienced an error at build line:

    building 'pyodbc' extension

    The ultimate error line reads:

    error: command 'gcc' failed with exit status 1

    It appears to have looked for and not found several files or directories. For example, I received several (7) lines of error like:

    gcc.exe: error: /Wall: No such file or directory

    I have a wild hunch that the install of Anaconda is upsetting my PATH variables (or something), but it's just a hunch.

    Thanks kindly.