pylzma icon indicating copy to clipboard operation
pylzma copied to clipboard

"pip instal pylzma" not working

Open TheDarkTiger opened this issue 3 years ago • 4 comments

Greetings,

Despite being on windows, I can't / don't want to install the Visual Studio 2003 compiler. I finally found someone whom have compiled the wheel files that I could install using pip install pylzma-0.5.0-XXX.whl Wheels can be downloaded here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pylzma

But that's really painful and not automatize-able. I get it that you prefer to install the library using source code by default, and that's great. But could you too give a wheel option, at least for the latest version of python?

I mean, I now hesitate to use this package in my projects, because it won't be easy for the users to install this lib if pip throws an error each time they try to install it.

If I missed something, please, do tell me. Thank you for your work on this library.

TheDarkTiger avatar Nov 27 '22 03:11 TheDarkTiger

Hey, @TheDarkTiger the wheel file is not there.

I am also facing the same issue, this is how I solved it. FYI @fancycode

When it did this, pip install pylzma, I get this error, image

Same error occurs when I am running these commands in python shell, from distutils import msvccompiler or from distutils.msvccompiler import MSVCCompiler

Although, when I tried to import the MSVCCompiler in python shell with this command, from distutils._msvccompiler import MSVCCompiler it imported just fine. Please see the screenshot below.

image

Initially I thought it's just file naming issue, but this is how I solved it, it's just a workaround, and I am also getting deprecation warnings, when I am running pip show pylzma

DEPRECATION: Loading egg at f:\fcc-gpt-scratch\cuda\lib\site-packages\pylzma-0.5.0.post17.dev0-py3.13-win-amd64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330

Steps 1 - Change from distutils.msvccompiler import MSVCCompiler to from distutils._msvccompiler import MSVCCompiler https://github.com/fancycode/pylzma/blob/ccb0e7cff3f6ecd5d38e73e9ca35502d7d670176/setup.py#L94

Step 2 - Reformat the string version in _normalize_version method, in file Lib\site-packages\setuptools\dist.py :370 from version to version = version[:-6] second hyphen is causing regex to return None. In Version(version). https://github.com/pypa/setuptools/blob/e5f16a2a990ff18cdef27a22b742f97444867186/setuptools/dist.py#L370

Step 3 - Then I created two files, _msvccompiler.py and msvccompiler.py in this folder, https://github.com/pypa/setuptools/tree/main/setuptools/_distutils

And it worked.

Please tell me if there is another way to achieve this, or if I can be of any help.

tr1ppyb0y avatar Oct 22 '24 12:10 tr1ppyb0y

Thanks for your nice explanations. I think I ended up using something else in the end, but your solution seems clean, and should be investigated indeed. But seeing as this repository is not updated since years if not a decade, it's unlikely. I hope the next people that want or need to install this lib will see you message! Cheers!

TheDarkTiger avatar Jan 13 '25 21:01 TheDarkTiger

Hi! I had the same problem on a Windows installation using Python 3.13. Following the above advice, here is how I solved it without changing setuptools:

  • in setup.py, replaced distutils.msvccompiler with distutils._msvccompiler
  • in version.py, added text=True to the Popen() arguments in call_git_describe() otherwise the returned object is a binary string and stuff like if version[:1] == 'v' will not work as expected
  • in version.py, changed return version to return version.replace('-g', '+g') to make setuptools happy

samhocevar avatar Oct 19 '25 11:10 samhocevar

Sweet, almost 3 years latter, the issue is getting fixed! Also, samhocevar, your solution is clean, that's perfect. Thanks.

TheDarkTiger avatar Nov 07 '25 02:11 TheDarkTiger