pypiserver / pypiserver

Minimal PyPI server for uploading & downloading packages with pip/easy_install

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'distutils' on Python 3.12

Anienem opened this issue · comments

I am attempting to install a new local Pypi server, but I get an error about "no module named distutils". According to the Python changelog, distutils was removed in 3.12.

pypiserver version: 2.0.1
Python version: 3.12

Error log:

C:\Users\EvSmith\Desktop\Automation\pypitest>python --version
Python 3.12.0

C:\Users\EvSmith\Desktop\Automation\pypitest>python -m venv venv

C:\Users\EvSmith\Desktop\Automation\pypitest>.\venv\Scripts\activate

(venv) C:\Users\EvSmith\Desktop\Automation\pypitest>pip install pypiserver==2.0.1
Collecting pypiserver==2.0.1
  Obtaining dependency information for pypiserver==2.0.1 from https://files.pythonhosted.org/packages/34/95/6c70e2f7e8375354fd7b1db08405c93674f2e4ce4e714f379fadd06a92b1/pypiserver-2.0.1-py2.py3-none-any.whl.metadata
  Downloading pypiserver-2.0.1-py2.py3-none-any.whl.metadata (48 kB)
     ---------------------------------------- 49.0/49.0 kB 165.6 kB/s eta 0:00:00
Requirement already satisfied: pip>=7 in c:\users\evsmith\desktop\automation\pypitest\venv\lib\site-packages (from pypiserver==2.0.1) (23.2.1)
Downloading pypiserver-2.0.1-py2.py3-none-any.whl (92 kB)
   ---------------------------------------- 92.5/92.5 kB 1.3 MB/s eta 0:00:00
Installing collected packages: pypiserver
Successfully installed pypiserver-2.0.1

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

(venv) C:\Users\EvSmith\Desktop\Automation\pypitest>pypi-server -p 8080 --log-file pypiserver.log
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\EvSmith\Desktop\Automation\pypitest\venv\Scripts\pypi-server.exe\__main__.py", line 4, in <module>
  File "C:\Users\EvSmith\Desktop\Automation\pypitest\venv\Lib\site-packages\pypiserver\__init__.py", line 8, in <module>
    from pypiserver.config import Config, RunConfig, strtobool
  File "C:\Users\EvSmith\Desktop\Automation\pypitest\venv\Lib\site-packages\pypiserver\config.py", line 46, in <module>
    from distutils.util import strtobool as strtoint
ModuleNotFoundError: No module named 'distutils'

Hello @Anienem! Thank you so much for reporting this issue! I'm very worrying the inconvenience this causes :( As of now, pypi-server is not yet compatible with Python 3.12 😔. I've started working on a fix #539, but it's not yet ready - the end of the year is a very busy time for my non open-source adventures 🙈. But I hope to get to resolving this with the next spare time (any help is of course welcome on that PR or otherwise ❤️‍🩹), I imagine this is problematic.

For now, do you have a chance to run pypi-server (also 2.0.1) on Python 3.11 in your environment? That should make it usable again.

Please let me know if that's an option. And sorry for the trouble once more.

@dee-me-tree-or-love thanks for the response! We were able to work around this error and keep using Python 3.12 by adding the latest version of setuptools to our requirements file and installing that alongside pypiserver. I don't know if we'll run into any issues with that down the line, but everything has come back up successfully so far.

@dee-me-tree-or-love thanks for the response! We were able to work around this error and keep using Python 3.12 by adding the latest version of setuptools to our requirements file and installing that alongside pypiserver. I don't know if we'll run into any issues with that down the line, but everything has come back up successfully so far.

Oh great, thanks a lot for the news @Anienem! Glad to hear it worked, I think that's a good workaround for the time being, thanks a lot for sharing it!

Then at any rate, I'll ping you in this issue once pypi-server naturally supports Python 3.12. ✌️

#539 was merged and apparently released in v2.1.0, I think this can be closed?

#539 was merged and apparently released in v2.1.0, I think this can be closed?

Thanks for the hint @pawamoy, indeed I think this should be able to close it!
@Anienem if you still notice the issues after upgrading to v2.1.0, feel free to reopen! ✌️