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

ModuleNotFoundError: No module named 'packaging' #3

Closed
tobsecret opened this issue Feb 16, 2020 · 4 comments
Closed

ModuleNotFoundError: No module named 'packaging' #3

tobsecret opened this issue Feb 16, 2020 · 4 comments

Comments

@tobsecret
Copy link

When importing the cptac module, I am getting the following error:

$ python -c"import cptac"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/gpfs/home/schrat01/cptac_test/lib/python3.7/site-packages/cptac/__init__.py", line 19, in <module>
    from .file_download import download
  File "/gpfs/home/schrat01/cptac_test/lib/python3.7/site-packages/cptac/file_download.py", line 16, in <module>
    from .file_tools import *
  File "/gpfs/home/schrat01/cptac_test/lib/python3.7/site-packages/cptac/file_tools.py", line 16, in <module>
    import packaging.version
ModuleNotFoundError: No module named 'packaging'

This looks to be the same issue as pypa/setuptools#937, however, I tried several setuptools versions (45.2.0, 40.9.0, 38.6.0, 36.7.2 and 32.3.1) and none worked.
What ended up doing the job is just conda install packaging.

Since all the top google results for the original problem pointed towards updating setuptools issues with regards to this error, I am not sure things are working as intended here.
Is packaging normally a requirement of setuptools? Because setuptools imported just fine, no idea why packaging was not installed when it was clearly required. Is this an issue with the pip recipe of the cptac package, or maybe an issue with the conda recipe for setuptools?

@caleb-lindgren
Copy link
Collaborator

Thanks for bringing this up! We had someone else have the exact same problem. The issue arises from not having the packaging module installed, and as you found, installing packaging manually fixes it.

We didn't have the module required in cptac's details because it happened to be installed by default in our environments; we didn't realize that not everyone would have it by default. We've now added it to the pip install requirements, so in all future versions it will be installed automatically if someone doesn't already have it, when they install or update cptac.

So for now, if anyone else has this issue, they can fix it by installing the packaging module manually--either using pip install packaging or conda install packaging. And after the next cptac update, the issue will be prevented automatically.

@tobsecret
Copy link
Author

Aaah ok, thanks for fixing it so quickly!

@Enduren
Copy link

Enduren commented Oct 24, 2022

Yes!!! thank you!!! pip install packaging worked for me

@tasmiatasrin
Copy link

I installed Transformers using pip. After installation, I wanted make sure the installation is running. So, I ran the command:

python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"

But I am getting following error, though I already installed packaging with pip in my virtual conda env:

Traceback (most recent call last):
File "", line 1, in
File "/home/tasmia/anaconda3/envs/minigrid_dev/lib/python3.9/site-packages/transformers/init.py", line 26, in
from . import dependency_versions_check
File "/home/tasmia/anaconda3/envs/minigrid_dev/lib/python3.9/site-packages/transformers/dependency_versions_check.py", line 16, in
from .utils.versions import require_version, require_version_core
File "/home/tasmia/anaconda3/envs/minigrid_dev/lib/python3.9/site-packages/transformers/utils/init.py", line 19, in
from packaging import version
ModuleNotFoundError: No module named 'packaging'

I have pip-23.3.1, transformers 4.34.1.

What else can be dome to resolve this?

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

No branches or pull requests

4 participants