flupke / pypotrace

Python bindings for potrace library
Other
165 stars 43 forks source link

macOS Catalina -- ModuleNotFoundError: No module named 'potrace' #25

Closed karipov closed 3 years ago

karipov commented 4 years ago

I'm currently on macOS Catalina 10.15 (19A583).

Installed pypotrace (0.2) with pipenv. Here is part of the Pipfile.lock:

"pypotrace": {
    "hashes": [
        "sha256:7e06c10f515b92c6ae3decc2a1b5ffb12f666d00b72ecec285ed0cbdce8ad255"
    ],
    "index": "pypi",
    "version": "==0.2"
},

When trying to import it get the following error:

Python 3.7.3 (default, Sep  5 2019, 17:14:41) 
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import potrace
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'potrace'
>>> 

Pipfile:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
flake8 = "*"

[packages]
numpy = "*"
pillow = "*"
scipy = "*"
pypotrace = "==0.2"

[requires]
python_version = "3.7"

I've also installed the library with pip outside of the pipenv virtual environment. The same error persists.

Edit: After trying to install from source as shown in the README, I get the following error (full here):

potrace/_potrace.c:596:10: fatal error: 'potracelib.h' file not found
#include "potracelib.h"
         ^~~~~~~~~~~~~~
1 error generated.
error: command 'xcrun' failed with exit status 1

Installation outside of the pipenv virtual environment 'worked', but when importing, still get a ModuleNotFoundError for 'potrace'.

I've ran all the tests with nosetests -v and get the following errors:

Failure: ModuleNotFoundError (No module named 'potrace._potrace') ... ERROR
Failure: ModuleNotFoundError (No module named 'potrace._potrace') ... ERROR
Failure: ModuleNotFoundError (No module named 'potrace._potrace') ... ERROR
karipov commented 4 years ago

After reviewing this reply in #17 all tests succeeded. Still, seems like an issue to fix as it is causing a number of other problems.

Thanks!

flupke commented 4 years ago

Hi, looks like some incompatibility between pipenv and cython-setuptools (a tool I wrote to descibe Cython modules in setup.cfg). I did a test project and reproduced your issue, though I don't really know where to start from there, as I'm not familiar with pipenv at all.

flupke commented 4 years ago

It should work with pip though, can you paste the output of pip install cython-setuptools -vvv --ignore-installed in your venv please?

karipov commented 4 years ago

@flupke The installation is successful, the output is too long so here is the pastebin: https://pastebin.com/Lcmq7dHk

karipov commented 4 years ago

Also, I've mentioned that your reply in #17 solved my issue outside of the venv. However, later I've found that potrace could only be imported within the git cloned version of this repository. Importing potrace outside of that folder was met with the same ImportError.