user2920100
user2920100

Reputation: 89

Anaconda: installing Python modules

I just installed Anaconda on Mac OSX Yosemite and I have it up and running, including Python, although I think there is something wrong with my paths when I try to "pip install" new modules.

Both "which python" and "which pip" commands point to my Anaconda folder. Moreover, doing a "pip install webbpsf" seems to go through but the module does not appear in the "conda list" nor does it get imported when I run my script (ImportError: no module named webbpsf).

I tried to install the webbpsf module manually (from the downloaded module directory) using "python setup.py install" but I'm getting an error that I believe is pointing to the source of the problem, namely the /username/py-lib/ path. See below:

Checking .pth file support in /username/py-lib/
/username/anaconda/bin/python -E -c pass
TEST FAILED: /username/py-lib/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/username/py-lib/

and your PYTHONPATH environment variable currently contains:

'/username/anaconda/lib/python2.7/site-packages'

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

I dug deep to try to find where/how this /py-lib/ path is set and I looked into the recommended link to no avail. What am I missing here?

Upvotes: 2

Views: 2728

Answers (2)

user2920100
user2920100

Reputation: 89

My problem was that the directory /username/py-lib/ (and also /username/py-bin/) were forcefully set in ~/.pydistutils.cfg. I remove the file and "pip install whatever_module" does what it's supposed to do.

Upvotes: 1

mjeffin
mjeffin

Reputation: 1

Try using the python bin file in the anaconda folder to install the setup.py file.

Upvotes: 0

Related Questions