<#1970 Pex does not support `#subdirectory=X` in a...
# github-notifications
q
#1970 Pex does not support `#subdirectory=X` in archive URLs New issue created by jsirois Although subdirectory works for VCS URLs:
Copy code
$ pex "sdev_logging_utils @ git+<https://github.com/SerialDev/sdev_py_utils@bd4d36a0#subdirectory=sdev_logging_utils>" -- -c 'import sdev_logging_utils; print(sde
v_logging_utils.__file__)'
/home/jsirois/.pex/installed_wheels/17ea6d41d9e674356d65867174aedd68eebe1f27c9c3af7caa5b41220e9fa3f1/sdev_logging_utils-0.1-py3-none-any.whl/sdev_logging_utils/__init__.py
They do not work for archives:
Copy code
$ pex "sdev_logging_utils @ <https://github.com/SerialDev/sdev_py_utils/archive/bd4d36a0.zip#subdirectory=sdev_logging_utils>" -- -c 'import sdev_logging_utils; p
rint(sdev_logging_utils.__file__)'
pid 27573 -> /home/jsirois/.pex/venvs/eb7094f36ecbc6fef7a9ae166bfc5e280dfd242b/5985ed09b49a653d6596b0e14d134c5456cf1a9f/bin/python -sE /home/jsirois/.pex/venvs/eb7094f36ecbc6fef7a9ae166bfc5e280dfd242b/5985ed09b49a653d6596b0e14d134c5456cf1a9f/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --use-deprecated legacy-resolver --isolated -q --cache-dir /home/jsirois/.pex/pip_cache wheel --no-deps --wheel-dir /home/jsirois/.pex/built_wheels/sdists/bd4d36a0.zip/1eaf75287d0a0a4a820f6fd7661ccef36c22e448b40733c8b7dab26060f9203e/cp310-cp310-manylinux_2_35_x86_64.workdir /home/jsirois/.pex/downloads/resolver_download.93vmt089/home.jsirois.bin.pex.venv.bin.python/bd4d36a0.zip --index-url <https://pypi.org/simple> --retries 5 --timeout 15 exited with 1 and STDERR:
    ERROR: Command errored out with exit status 1:
     command: /home/jsirois/.pex/venvs/eb7094f36ecbc6fef7a9ae166bfc5e280dfd242b/5985ed09b49a653d6596b0e14d134c5456cf1a9f/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jsirois/.pex/pip_cache/.tmp/pip-req-build-1lio9mtt/setup.py'"'"'; __file__='"'"'/home/jsirois/.pex/pip_cache/.tmp/pip-req-build-1lio9mtt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg egg_info --egg-base /home/jsirois/.pex/pip_cache/.tmp/pip-pip-egg-info-sugze2us
         cwd: /home/jsirois/.pex/pip_cache/.tmp/pip-req-build-1lio9mtt/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.10/tokenize.py", line 394, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/home/jsirois/.pex/pip_cache/.tmp/pip-req-build-1lio9mtt/setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
This is as opposed to Pex's vendored Pip itself, which does work in either case:
Copy code
$ PYTHONPATH=pex/vendor/_vendored/pip python -mpip -V
pip 20.3.4 from /home/jsirois/dev/pantsbuild/jsirois-pex/pex/vendor/_vendored/pip/pip (python 3.10)

$ rm -rf pip-test && PYTHONPATH=pex/vendor/_vendored/pip python -mpip install --prefix pip-test "sdev_logging_utils @ git+<https://github.com/SerialDe/sdev_py_utils@bd4d36a0#subdirectory=sdev_logging_utils>"
Collecting sdev_logging_utils@ git+<https://github.com/SerialDev/sdev_py_utils@bd4d36a0#subdirectory=sdev_logging_utils>
  Cloning <https://github.com/SerialDev/sdev_py_utils> (to revision bd4d36a0) to /tmp/pip-install-92f0p4va/sdev-logging-utils_7de7920fd66b412297c724bde456f193
  Running command git clone -q <https://github.com/SerialDev/sdev_py_utils> /tmp/pip-install-92f0p4va/sdev-logging-utils_7de7920fd66b412297c724bde456f193
  WARNING: Did not find branch or tag 'bd4d36a0', assuming revision or ref.
  Running command git checkout -q bd4d36a0
Using legacy 'setup.py install' for sdev-logging-utils, since package 'wheel' is not installed.
Installing collected packages: sdev-logging-utils
    Running setup.py install for sdev-logging-utils ... done
Successfully installed sdev-logging-utils-0.1
WARNING: You are using pip version 20.3.4; however, version 22.3 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.

$ rm -rf pip-test && PYTHONPATH=pex/vendor/_vendored/pip python -mpip install --prefix pip-test "sdev_logging_utils @ <https://github.com/SerialDev/sdev_py_utils/archive/bd4d36a0.zip#subdirectory=sdev_logging_utils>"
Collecting sdev_logging_utils@ <https://github.com/SerialDev/sdev_py_utils/archive/bd4d36a0.zip#subdirectory=sdev_logging_utils>
  Downloading <https://github.com/SerialDev/sdev_py_utils/archive/bd4d36a0.zip>
     - 251 kB 353 kB/s
Using legacy 'setup.py install' for sdev-logging-utils, since package 'wheel' is not installed.
Installing collected packages: sdev-logging-utils
    Running setup.py install for sdev-logging-utils ... done
Successfully installed sdev-logging-utils-0.1
WARNING: You are using pip version 20.3.4; however, version 22.3 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.
pantsbuild/pex