Ray: Trouble installing in virtual env.

Created on 7 Feb 2017  路  3Comments  路  Source: ray-project/ray

Someone attempting to install Ray with python setup.py install (within a virtualenv on Mac OS X) got the error message below.

Note:

  1. I tried it myself in a virtualenv, and that worked fine on my machine, so the virtualenv may not be the problem.
  2. As a workaround, doing ./build.sh worked fine, and then doing python setup.py develop worked.
TEST FAILED: /Users/user/.local/lib/python3.5/site-packages/ 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:

    /Users/user/.local/lib/python3.5/site-packages/

and your PYTHONPATH environment variable currently contains:

    '/usr/local/opt/opencv3/lib/python3.5/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://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations

Most helpful comment

I got a very similar error trying to install with virtualenv as well.

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:

    /home/michael/.local/lib/python3.5/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

My workaround was to just add the installation directory to my PYTHONPATH variable.
So I added
export PYTHONPATH=$PYTHONPATH:/home/michael/.local/lib/python3.5/site-packages/

to my .bashrc and installation went smoothly from there.

All 3 comments

I got a very similar error trying to install with virtualenv as well.

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:

    /home/michael/.local/lib/python3.5/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

My workaround was to just add the installation directory to my PYTHONPATH variable.
So I added
export PYTHONPATH=$PYTHONPATH:/home/michael/.local/lib/python3.5/site-packages/

to my .bashrc and installation went smoothly from there.

Interesting, I wonder if we're doing something wrong in setup.py. Thanks for the workaround!

Closing because installation in virtual envs doesn't seem to be a problem anymore.

Was this page helpful?
0 / 5 - 0 ratings