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

python_package installation fails because install path isn't on PYTHONPATH #106

Closed
moooeeeep opened this issue Sep 23, 2021 · 1 comment · Fixed by #113
Closed

python_package installation fails because install path isn't on PYTHONPATH #106

moooeeeep opened this issue Sep 23, 2021 · 1 comment · Fixed by #113

Comments

@moooeeeep
Copy link

moooeeeep commented Sep 23, 2021

Recently we are facing build errors when building and installing Python packages, e.g.:

running install
Checking .pth file support in /home/moooeeeep/workspace/install/some/package/lib/python3.6/site-packages/
/usr/bin/python3 -E -c pass
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
TEST FAILED: /home/moooeeeep/workspace/install/some/package/lib/python3.6/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:

    /home/moooeeeep/workspace/install/some/package/lib/python3.6/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

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


Please make the appropriate changes for your system and try again.

Apparantly the location to which the package is installed needs to be on the PYTHONPATH. Currently the PYTHONPATH entry is added after the installation. As the PYTHONPATH entry is added even when the build fails due to this error, the second run of amake is usually successful. But obviously this is still annoying.

I'm not sure if it is possible to disable this check or the error, to not fail the build. Potentially this is related to the separate prefix dirs setting.

On my machine I usually work around this by adjusting the install command to install to --user or via pip install .. But maybe this would affect other workflows that rely on these separate installation locations?

Potentially related: rock-core/autoproj#313

The URL given in the error message is broken, I think it was meant to refer to this content: https://setuptools.pypa.io/en/latest/deprecated/easy_install.html#custom-installation-locations

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

Successfully merging a pull request may close this issue.

2 participants