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 'pkg_resources' #1618

Open
3 tasks done
abdrysdale opened this issue Jul 12, 2024 · 2 comments · May be fixed by #1619
Open
3 tasks done

ModuleNotFoundError: No module named 'pkg_resources' #1618

abdrysdale opened this issue Jul 12, 2024 · 2 comments · May be fixed by #1619
Labels
information requested ❔ Cannot reproduce, waiting for minimum reproduction details.

Comments

@abdrysdale
Copy link

abdrysdale commented Jul 12, 2024

Current Behaviour

Thanks for the great repository!

Currently fails on the import with

import ydata_profilling

Resulting in:

Traceback (most recent call last):
  File "c:\Users\foo\test.py", line 9, in <module>
    import ydata_profiling
  File "C:\Users\foo\AppData\Local\pypoetry\Cache\virtualenvs\foo-nnQxNQNi-py3.12\Lib\site-packages\ydata_profiling\__init__.py", line 14, in <module>
    from ydata_profiling.compare_reports import compare  # isort:skip # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\foo\AppData\Local\pypoetry\Cache\virtualenvs\foo-nnQxNQNi-py3.12\Lib\site-packages\ydata_profiling\compare_reports.py", line 12, in <module>
    from ydata_profiling.profile_report import ProfileReport
  File "C:\Users\foo\AppData\Local\pypoetry\Cache\virtualenvs\foo-nnQxNQNi-py3.12\Lib\site-packages\ydata_profiling\profile_report.py", line 9, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Expected Behaviour

The library should be successfully imported.

Data Description

Currently not using any data as it fails on the import.

Code that reproduces the bug

import ydata_profiling

pandas-profiling version

4.8.3

Dependencies

annotated-types==0.7.0
attrs==23.2.0
certifi==2024.7.4
charset-normalizer==3.3.2
colorama==0.4.6
contourpy==1.2.1
cycler==0.12.1
dacite==1.8.1
fonttools==4.53.1
h5py==3.11.0
htmlmin==0.1.12
idna==3.7
ImageHash==4.3.1
Jinja2==3.1.4
joblib==1.4.2
kiwisolver==1.4.5
llvmlite==0.43.0
MarkupSafe==2.1.5
matplotlib==3.8.4
multimethod==1.12
networkx==3.3
numba==0.60.0
numpy==1.26.4
packaging==24.1
pandas==2.2.2
patsy==0.5.6
phik==0.12.4
pillow==10.4.0
pydantic==2.8.2
pydantic_core==2.20.1
pydicom==2.4.4
pyparsing==3.1.2
python-dateutil==2.9.0.post0
pytz==2024.1
PyWavelets==1.6.0
PyYAML==6.0.1
requests==2.32.3
scipy==1.13.1
seaborn==0.13.2
six==1.16.0
statsmodels==0.14.2
tqdm==4.66.4
typeguard==4.3.0
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.2
visions==0.7.6
wordcloud==1.9.3
ydata-profiling==4.8.3

OS

Windows 11

Checklist

  • There is not yet another bug report for this issue in the issue tracker
  • The problem is reproducible from this bug report. This guide can help to craft a minimal bug report.
  • The issue has not been resolved by the entries listed under Common Issues.
@abdrysdale
Copy link
Author

This seems to be due to setuptools not being installed. A simple pip install setuptools or poetry add setuptools solves the issue.

@abdrysdale abdrysdale linked a pull request Jul 12, 2024 that will close this issue
@abdrysdale
Copy link
Author

I've created a pull request for the fix which includes setuptools in the requirements.

However, it is worth noting that pkg_resources is being slowly depreciated in favor of importlib.resources and there is also a really handy migration guide on the subject matter.

It's worth noting that importlib.resources only supports the following APIs:

  • pkg_resources.resource_filename()
  • pkg_resources.resource_stream()
  • pkg_resources.resource_string()
  • pkg_resources.resource_listdir()
  • pkg_resources.resource_isdir()

so importlib.resources may not be an appropriate.

@fabclmnt fabclmnt added information requested ❔ Cannot reproduce, waiting for minimum reproduction details. and removed needs-triage labels Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information requested ❔ Cannot reproduce, waiting for minimum reproduction details.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants