indygreg / indygreg/PyOxidizer
Set PYTHONPATH for pip packaging rules
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 256
- PR merge metrics
- No merged PRs in 30d
Description
The following fails:
```toml
[[packaging_rule]]
type = "pip-install-simple"
package = "storyscript<0.26.0"
```
```console
...
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the implementation of the pip-install-simple packaging rule and the subprocess that invokes pip. Compare it with the virtualenv packaging rule, then verify that pip can install the reported storyscript package and that the installation directory is available through PYTHONPATH.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100