purepng icon indicating copy to clipboard operation
purepng copied to clipboard

Pip and setup.py fails to install

Open Husky2490 opened this issue 8 years ago • 7 comments

I've tried installing this using both pip install and python setup.py install from the extracted copy from the zip file downloaded by pip and both failed to install PurePNG. I know nothing when it comes to installing so I've attached copied text from the command prompt windows for both situations, using the highest verbosity in the pip scenario. Command_Prompt_setup.py.txt Command_Prompt_pip.txt

Footnote: the package that this is forked from, pypng, installs just fine

Husky2490 avatar May 07 '16 02:05 Husky2490

Seems some broken about compilation.

Try this setup.py https://raw.githubusercontent.com/Scondo/purepng/any_compile/setup.py

Scondo avatar May 07 '16 04:05 Scondo

I can reproduce this on my Mac when installing from PyPI:

pip uninstall -y purepng
env CC=/usr/bin/false pip install --no-cache-dir --upgrade --verbose purepng

But not when installing from a local clone:

pip uninstall -y purepng
env CC=/usr/bin/false pip install --no-cache-dir --upgrade --verbose ~/Documents/Code/purepng

It seems to skip the build_ext step. I have no clue why. Installing from a locally built sdist has the same effect.

brechtm avatar Aug 23 '16 07:08 brechtm

It seems you have no Cython installed.

Error appears when you try to compile pre-cythonized pngfilters.c and have compilation environment which is not able to compile python modules at all (Python.h is absent). This surprisingly result in non-compilation errors like [WinError 2] The system cannot find the file specified

There are two ways to resolve this bug: or do not provide pre-cythonized pngfilters.c or (any_compile branch) skip through any error during compilation.

I'm not sure which one is best.

Scondo avatar Aug 24 '16 10:08 Scondo

Anyway I'll change logging level to be clean that compilation is optional before next release. https://github.com/Scondo/purepng/blob/master/setup.py#L52

Scondo avatar Aug 24 '16 10:08 Scondo

Thanks. I can reproduce it from a clone with Cython installed.

This may be because I'm not familiar with Cython, but build_ext_optional doesn't seem to be hooked up. So making the try/except more general (any_compile branch) has no effect. Adding print statements in build_ext_optional.build_extension does not produce output when running setup.py.

Adding the following makes things work (even without making the try/except more general):

import distutils
distutils.command.build_ext.build_ext = build_ext_opt

brechtm avatar Aug 24 '16 12:08 brechtm

I've tried to found more gentle way, but after all use @brechtm way. https://github.com/Scondo/purepng/commit/fb5b8305f0cb24290c157e2d893951d699f74073

Scondo avatar Sep 22 '16 14:09 Scondo

Check 0.2.0

Scondo avatar Sep 30 '16 15:09 Scondo