fancycode / pylzma

Python bindings for the LZMA library
http://www.joachim-bauch.de/projects/pylzma/
GNU Lesser General Public License v2.1
234 stars 72 forks source link

"pip instal pylzma" not working #77

Open TheDarkTiger opened 2 years ago

TheDarkTiger commented 2 years ago

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.

tr1ppyb0y commented 1 month ago

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.