question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jupyterlab-black fails to install (packages with hyphens in name cause problems?)

See original GitHub issue

I noticed:

$ python --version
Python 3.7.7

$ python -m pip list | grep pipgrip
pipgrip              0.3.0

$ pipgrip --verbose --install jupyterlab-black
Traceback (most recent call last):
  File "/home/martin/.local/bin/pipgrip", line 10, in <module>
    sys.exit(main())
  File "/home/martin/.local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/martin/.local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/martin/.local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/martin/.local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/martin/.local/lib/python3.7/site-packages/pipgrip/cli.py", line 296, in main
    source.root_dep(root_dependency)
  File "/home/martin/.local/lib/python3.7/site-packages/pipgrip/package_source.py", line 147, in root_dep
    self.discover_and_add(req.__str__())
  File "/home/martin/.local/lib/python3.7/site-packages/pipgrip/package_source.py", line 126, in discover_and_add
    package, self.index_url, self.extra_index_url, self.cache_dir, self.pre
  File "/home/martin/.local/lib/python3.7/site-packages/pipgrip/pipper.py", line 337, in discover_dependencies_and_versions
    req.__str__(), index_url, extra_index_url, pre, cache_dir
  File "/home/martin/.local/lib/python3.7/site-packages/pipgrip/pipper.py", line 269, in _download_wheel
    str({package: os.path.join(cache_dir, fname.lstrip(os.path.sep))})
UnboundLocalError: local variable 'fname' referenced before assignment

…and that the fname detection in pipper._download_wheel seems not to work for jupyter-black and other packages with hyphens in their name:

(Pdb) l
249                             )
250                             if package.startswith("."):
251                                 fname = all_wheels[0]
252                             else:
253                                 pkg = canonicalize_name(package)
254  ->                             for whl in all_wheels:
255                                     if pkg in whl:
256                                         fname = whl
257                                         break
258                             break
259                     else:

(Pdb) pkg
'jupyterlab-black'

(Pdb) all_wheels
['jupyterlab_black-0.2.1-py3-none-any.whl', 'jupyterlab_commands-0.2.2-py2.py3-none-any.whl', 'jupyterlab_latex-2.0.0-py3-none-any.whl', 'jupyterlab-2.1.5-py3-none-any.whl', 'notebook-6.0.3-py3-none-any.whl', 'jupyter-1.0.0-py2.py3-none-any.whl', 'ipysankeywidget-0.3.0-py2.py3-none-any.whl']

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewv99commented, Aug 7, 2020

pip install -U git+https://github.com/ddelange/pipgrip.git@verbose-crash Looking in indexes: https://bridge4:9443/repository/rdc-python-all/simple Collecting git+https://github.com/ddelange/pipgrip.git@verbose-crash Cloning https://github.com/ddelange/pipgrip.git (to revision verbose-crash) to /tmp/pip-req-build-kamhauj7 Running command git clone -q https://github.com/ddelange/pipgrip.git /tmp/pip-req-build-kamhauj7 Running command git checkout -b verbose-crash --track origin/verbose-crash Switched to a new branch ‘verbose-crash’ Branch ‘verbose-crash’ set up to track remote branch ‘verbose-crash’ from ‘origin’. Requirement already satisfied, skipping upgrade: anytree in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from pipgrip==0.6.1.dev1) (2.8.0) Requirement already satisfied, skipping upgrade: click>=7 in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from pipgrip==0.6.1.dev1) (7.1.2) Requirement already satisfied, skipping upgrade: packaging>=17 in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from pipgrip==0.6.1.dev1) (20.4) Requirement already satisfied, skipping upgrade: pkginfo>=1.4.2 in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from pipgrip==0.6.1.dev1) (1.5.0.1) Requirement already satisfied, skipping upgrade: setuptools>=38.3 in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from pipgrip==0.6.1.dev1) (41.0.1) Requirement already satisfied, skipping upgrade: wheel in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from pipgrip==0.6.1.dev1) (0.34.2) Requirement already satisfied, skipping upgrade: pip>=7.1.0 in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from pipgrip==0.6.1.dev1) (19.1.1) Requirement already satisfied, skipping upgrade: six>=1.9.0 in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from anytree->pipgrip==0.6.1.dev1) (1.15.0) Requirement already satisfied, skipping upgrade: pyparsing>=2.0.2 in /home/andrewv/p3env/pipgrip/lib/python3.6/site-packages (from packaging>=17->pipgrip==0.6.1.dev1) (2.4.7) Building wheels for collected packages: pipgrip Building wheel for pipgrip (setup.py) … done Stored in directory: /tmp/pip-ephem-wheel-cache-87o5fns1/wheels/ca/0b/34/63023b90dc2ad20b187e30c05ed7ccc28995b50cea48a10642 Successfully built pipgrip Installing collected packages: pipgrip Found existing installation: pipgrip 0.6.0 Uninstalling pipgrip-0.6.0: Successfully uninstalled pipgrip-0.6.0 Successfully installed pipgrip-0.6.1.dev1 WARNING: You are using pip version 19.1.1, however version 20.2.1 is available. You should consider upgrading via the ‘pip install --upgrade pip’ command.

pipgrip --verbose --install tensorflow==2.0.2 2>&1|tee err.log err.log

0reactions
andrewv99commented, Aug 7, 2020

Many thanks, confirming ok with 0.6.1:

pip install --force -U pipgrip==0.6.1 pipgrip --verbose tensorflow==2.0.2 2>&1|tee err3.log tensorflow==2.0.2 absl-py==0.9.0 six==1.15.0 astor==0.8.1 gast==0.2.2 google-pasta==0.2.0 grpcio==1.31.0 keras-applications==1.0.8 h5py==2.10.0 numpy==1.19.1 keras-preprocessing==1.1.2 opt-einsum==3.3.0 protobuf==3.12.4 setuptools==49.2.1 tensorboard==2.0.2 google-auth-oauthlib==0.4.1 google-auth==1.20.1 cachetools==4.1.1 pyasn1-modules==0.2.8 pyasn1==0.4.8 rsa==4.6 requests-oauthlib==1.3.0 oauthlib==3.1.0 requests==2.24.0 certifi==2020.6.20 chardet==3.0.4 idna==2.10 urllib3==1.25.10 markdown==3.2.2 importlib-metadata==1.7.0 zipp==3.1.0 werkzeug==1.0.1 wheel==0.34.2 tensorflow-estimator==2.0.1 termcolor==1.1.0 wrapt==1.12.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip packages names should not use underscores · Issue #18116
... I have discovered that pip does not use underscores in package names (they are discouraged in PEP8). While pip install face_recognition ...
Read more >
How to import module when module name has a '-' dash or ...
This was my scenario: I have a python library cloned in a git submodule which ... importlib, because python has issues with dash...
Read more >
What's up with scripts and hyphens/underscores?!?! - Packaging
I have a package that's been working for years – its name includes a underscore: adios_db (GitHub - NOAA-ORR-ERD/adios_oil_database) It ...
Read more >
Hyphen in my computer's name causing T-SQL error
I get an error: Incorrect syntax near '-'. I think the problem is the hyphen in my computer's name. Is there a way...
Read more >
Unable to install python package via pip from pypi repository if ...
When a Python package contains a period character in its name, it cannot be installed via pip, as pip fails to locate the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found