Skip to content

Set PYTHONPATH for pip packaging rules #162

@jayvdb

Description

@jayvdb

The following fails:

[[packaging_rule]]
type = "pip-install-simple"
package = "storyscript<0.26.0"
...
    Running setup.py install for storyscript: started
    Running setup.py install for storyscript: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /path/to/project/build/target/x86_64-unknown-linux-gnu/debug/pyoxidizer/python.608871543e6d/python/install/bin/python3.7m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h0rudgt_/storyscript/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h0rudgt_/storyscript/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-b6xa8xr1/install-record.txt --single-version-externally-managed --compile --home=/tmp/pip-target-t8k9ny8u
         cwd: /tmp/pip-install-h0rudgt_/storyscript/
    Complete output (33 lines):
    running install
    Checking .pth file support in /tmp/pip-target-t8k9ny8u/lib/python/
    /path/to/project/build/target/x86_64-unknown-linux-gnu/debug/pyoxidizer/python.608871543e6d/python/install/bin/python3.7m -E -c pass
    TEST FAILED: /tmp/pip-target-t8k9ny8u/lib/python/ 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:
    
        /tmp/pip-target-t8k9ny8u/lib/python/
    
    and your PYTHONPATH environment variable currently contains:
    
        '/tmp/pyoxidizer-pip-install.R2XWB5qBRAW1/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
    
    
    Please make the appropriate changes for your system and try again.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /path/to/project/build/target/x86_64-unknown-linux-gnu/debug/pyoxidizer/python.608871543e6d/python/install/bin/python3.7m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h0rudgt_/storyscript/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h0rudgt_/storyscript/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-b6xa8xr1/install-record.txt --single-version-externally-managed --compile --home=/tmp/pip-target-t8k9ny8u Check the logs for full command output.

The cause is a hack in the setup.py (fixed but not released https://github.com/storyscript/storyscript/issues/1178).

The workaround is to use a virtualenv packaging rule, which uses the wheel.

It wont be very common, but it is solvable by setting PYTHONPATH in the subprocess invoking pip.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions