intro-stat-learning / ISLP

ISLP package: data and code for labs
Other
114 stars 41 forks source link

ModuleNotFoundError for 'distutils' during pip installation of ISLP #25

Open pChitral opened 6 months ago

pChitral commented 6 months ago

Issue Description

I encountered a ModuleNotFoundError for 'distutils' while trying to install the ISLP package directly via pip in a newly set up Python virtual environment. However, when I used a requirements.txt from the project's GitHub via pip, the installation succeeded without errors. Below are the steps and the error message for the unsuccessful attempt and the command for the successful installation:

Unsuccessful Installation Commands:

python3 -m venv venv
source venv/bin/activate
pip install ISLP

Error Message:

ERROR: Exception:
Traceback (most recent call last):
  [Error traceback shortened for clarity]
  File "/private/var/folders/q4/72ybtynd5sjf5ppl_5vpsw080000gn/T/pip-build-env-qctzgd2p/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 10, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils'

Successful Installation Command:

pip install -r https://raw.githubusercontent.com/intro-stat-learning/ISLP_labs/v2/requirements.txt

Environment:

jonathan-taylor commented 5 months ago

The pip version you tried did not support python3.12 (see https://intro-stat-learning.github.io/ISLP/installation.html). Will release an update. The frozen requirements file is mostly for tagging the version used to build the labs (and v2 is not the current one, the current would be v2.1.3