mwilliamson / python-mammoth

Convert Word documents (.docx files) to HTML
BSD 2-Clause "Simplified" License
785 stars 121 forks source link

Can't install python mammoth on Ubuntu 22.04.2 LTS & Python 3.9.16 #132

Closed MalikRumi closed 1 year ago

MalikRumi commented 1 year ago

If you're reporting a bug or requesting a feature, please include:

(chronicle) malikarumi@Tetuoan2:~/Projects/lifeandtimes/chronicle$ pip3 install mammoth
Collecting mammoth
  Using cached mammoth-1.5.0-py2.py3-none-any.whl (51 kB)
Collecting cobble<0.2,>=0.1.3
  Using cached cobble-0.1.3.tar.gz (11 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I get the same error with pip and pip3. I use PyCharm 2022.3. I also get this error trying to upgrade setuptools. These two answers suggested python3-distutils:

`https://youtrack.jetbrains.com/issue/PY-49687 https://superuser.com/questions/1319047/cant-install-virtual-interpreter-in-pycharm-in-linux/1319060#1319060

(chronicle) malikarumi@Tetuoan2:~/Projects/lifeandtimes/chronicle$ sudo apt-get install python3-distutils

python3-distutils is already the newest version (3.10.6-1~22.04). python3-distutils set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. ` I am out of ideas. Your assistance is greatly appreciated.

mwilliamson commented 1 year ago

It looks you need to install setuptools. The right way of doing so will depend on how you're running Python. For instance, if you're in a virtual environment, you'd want to do pip install setuptools, although my fuzzy, possibly incorrect recollection was that virtual environments come with setuptools already installed, so you shouldn't see this if so. If you're using the system Python and Pip, then you'd want to install python3-setuptools.

Having said all that, the right answer is probably to provide a pyproject.toml.

mwilliamson commented 1 year ago

There's now an explicit dependency on setuptools in pyproject.toml, so hopefully this should resolve the issue in environments where setuptools is not available.