New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no attribute __reduce_cython__ #1953

Closed
cschramm opened this Issue Oct 28, 2017 · 36 comments

Comments

Projects
None yet
@cschramm

cschramm commented Oct 28, 2017

#1894 (comment).

I'm getting an AttributeError due to a missing __reduce_cython__ attribute in an embedded environment when I build lxml with Cython 0.26 or 0.27. 0.25(.2) works fine. The issue seems to be triggered by reinitializing the environment but unfortunately I was not able to find a minimal sample that replicates it yet.

I did a git-bisect and found f8b3405 to be the first broken commit.

Will try to find a simple test case, but I'm not sure how soon I'll have a result.

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Oct 29, 2017

Contributor

What Python version are you using?
Is that with the latest lxml release?
Does it also fail with the pre-generated C files that lxml ships, i.e. without rerunning Cython?
Could you please provide the complete stack trace of the failure that you get?

Contributor

scoder commented Oct 29, 2017

What Python version are you using?
Is that with the latest lxml release?
Does it also fail with the pre-generated C files that lxml ships, i.e. without rerunning Cython?
Could you please provide the complete stack trace of the failure that you get?

@cschramm

This comment has been minimized.

Show comment
Hide comment
@cschramm

cschramm Oct 29, 2017

I was able to isolate it now. 🎉

Python 3.6.3, lxml 3.8.0, Cython 0.26.1

Py_Initialize();

PyObject *pName = PyUnicode_FromString("lxml.etree");

PyImport_Import(pName);

Py_Finalize();
Py_Initialize();

PyImport_Import(pName);
PyErr_Print();

=>

Traceback (most recent call last):
  File "src/lxml/etree.pyx", line 287, in init lxml.etree
    cdef class _TempStore:
AttributeError: type object 'lxml.etree._TempStore' has no attribute '__reduce_cython__'

From my previous tests it should be the same for all Cython 0.26 and 0.27 versions while 0.25.2 works.
I did not try other Python versions.
It does not affect lxml 4.0.0. I traced that down to lxml/lxml@3e2967b, so I guess recent versions would show the same issue if you re-enable that "auto_pickle" feature.

cschramm commented Oct 29, 2017

I was able to isolate it now. 🎉

Python 3.6.3, lxml 3.8.0, Cython 0.26.1

Py_Initialize();

PyObject *pName = PyUnicode_FromString("lxml.etree");

PyImport_Import(pName);

Py_Finalize();
Py_Initialize();

PyImport_Import(pName);
PyErr_Print();

=>

Traceback (most recent call last):
  File "src/lxml/etree.pyx", line 287, in init lxml.etree
    cdef class _TempStore:
AttributeError: type object 'lxml.etree._TempStore' has no attribute '__reduce_cython__'

From my previous tests it should be the same for all Cython 0.26 and 0.27 versions while 0.25.2 works.
I did not try other Python versions.
It does not affect lxml 4.0.0. I traced that down to lxml/lxml@3e2967b, so I guess recent versions would show the same issue if you re-enable that "auto_pickle" feature.

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Oct 29, 2017

Contributor

Thanks for digging up the details. Extension modules that support reloading are probably still extremely rare. Definitely not lxml. And the support in Cython is still pending (#1715).

Contributor

scoder commented Oct 29, 2017

Thanks for digging up the details. Extension modules that support reloading are probably still extremely rare. Definitely not lxml. And the support in Cython is still pending (#1715).

@cschramm

This comment has been minimized.

Show comment
Hide comment
@cschramm

cschramm Oct 30, 2017

Sad to hear that.

I'm not 100 % sure what you mean. Multi-phase initialization isn't necessary for extension modules to support reloading, is it? We didn't ever have any issues with reloading lxml up to now (well, there might be hidden memory leaks of course).

Anyway, now that I know that it's only an issue with lxml (<)= 3.8.0 && Cython >= 0.26.0 it's not a real problem for me (the way to get around it is just to use a recent lxml version if you use a recent Cython version). It would only become a problem again if the lxml project decides to re-enable auto_pickle.

cschramm commented Oct 30, 2017

Sad to hear that.

I'm not 100 % sure what you mean. Multi-phase initialization isn't necessary for extension modules to support reloading, is it? We didn't ever have any issues with reloading lxml up to now (well, there might be hidden memory leaks of course).

Anyway, now that I know that it's only an issue with lxml (<)= 3.8.0 && Cython >= 0.26.0 it's not a real problem for me (the way to get around it is just to use a recent lxml version if you use a recent Cython version). It would only become a problem again if the lxml project decides to re-enable auto_pickle.

@jmschrei

This comment has been minimized.

Show comment
Hide comment
@jmschrei

jmschrei Dec 26, 2017

I started seeing this recently as well in my AppVeyor builds. One can be seen here: https://ci.appveyor.com/project/JacobSchreiber/pomegranate/build/1.0.449/job/12bpi71jy7aiwmve

Here is a full error:

======================================================================
ERROR: Failure: AttributeError (type object 'pomegranate.base.Model' has no attribute '__reduce_cython__')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Miniconda3\envs\test-environment\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "C:\Miniconda3\envs\test-environment\lib\site-packages\nose\loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Miniconda3\envs\test-environment\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Miniconda3\envs\test-environment\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\Miniconda3\envs\test-environment\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Miniconda3\envs\test-environment\lib\imp.py", line 171, in load_source
    module = methods.load()
  File "<frozen importlib._bootstrap>", line 1220, in load
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "C:\projects\pomegranate\tests\test_distributions.py", line 3, in <module>
    from pomegranate import (Distribution,
  File "c:\projects\pomegranate\pomegranate\__init__.py", line 9, in <module>
    from .base import *
  File "pomegranate\base.pyx", line 18, in init pomegranate.base
    cdef class Model(object):
AttributeError: type object 'pomegranate.base.Model' has no attribute '__reduce_cython__'

I don't get these issues on the Python 2.7 builds, only the Python 3.4 builds. It uses Cython 0.27 but I'm going to try downgrading to 0.25.

Edit: To clarify, these are unit tests that previously passed, and recently, without modification to the code or the unit test, started failing.

jmschrei commented Dec 26, 2017

I started seeing this recently as well in my AppVeyor builds. One can be seen here: https://ci.appveyor.com/project/JacobSchreiber/pomegranate/build/1.0.449/job/12bpi71jy7aiwmve

Here is a full error:

======================================================================
ERROR: Failure: AttributeError (type object 'pomegranate.base.Model' has no attribute '__reduce_cython__')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Miniconda3\envs\test-environment\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "C:\Miniconda3\envs\test-environment\lib\site-packages\nose\loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Miniconda3\envs\test-environment\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Miniconda3\envs\test-environment\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\Miniconda3\envs\test-environment\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Miniconda3\envs\test-environment\lib\imp.py", line 171, in load_source
    module = methods.load()
  File "<frozen importlib._bootstrap>", line 1220, in load
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "C:\projects\pomegranate\tests\test_distributions.py", line 3, in <module>
    from pomegranate import (Distribution,
  File "c:\projects\pomegranate\pomegranate\__init__.py", line 9, in <module>
    from .base import *
  File "pomegranate\base.pyx", line 18, in init pomegranate.base
    cdef class Model(object):
AttributeError: type object 'pomegranate.base.Model' has no attribute '__reduce_cython__'

I don't get these issues on the Python 2.7 builds, only the Python 3.4 builds. It uses Cython 0.27 but I'm going to try downgrading to 0.25.

Edit: To clarify, these are unit tests that previously passed, and recently, without modification to the code or the unit test, started failing.

@chriscainx

This comment has been minimized.

Show comment
Hide comment
@chriscainx

chriscainx Apr 27, 2018

Encountered this too. Using python 3.6.5 and cython 0.27.3

>>> import _utils
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "stringsource", line 103, in init myproject._utils
AttributeError: type object 'myproject._utils.array' has no attribute '__reduce_cython__'
>>> quit()

chriscainx commented Apr 27, 2018

Encountered this too. Using python 3.6.5 and cython 0.27.3

>>> import _utils
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "stringsource", line 103, in init myproject._utils
AttributeError: type object 'myproject._utils.array' has no attribute '__reduce_cython__'
>>> quit()
@chriscainx

This comment has been minimized.

Show comment
Hide comment
@chriscainx

chriscainx Apr 27, 2018

When cythonize _utils.pyx outside somewhere and import there's no problem, but when building it under my package, then open python and import, or install the package then import goes wrong.

import _utils  
Traceback (most recent call last):
   File "", line 1, in
   File "stringsource", line 103, in init myproject._utils
AttributeError: type object 'myproject._utils.array' has no attribute 'reduce_cython'
quit()

chriscainx commented Apr 27, 2018

When cythonize _utils.pyx outside somewhere and import there's no problem, but when building it under my package, then open python and import, or install the package then import goes wrong.

import _utils  
Traceback (most recent call last):
   File "", line 1, in
   File "stringsource", line 103, in init myproject._utils
AttributeError: type object 'myproject._utils.array' has no attribute 'reduce_cython'
quit()
@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni May 4, 2018

Happens to me as well with pandas

File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)
  File "pandas\_libs\tslib.pyx", line 1510, in init pandas._libs.tslib
AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute '__reduce_cython__'

eliaperantoni commented May 4, 2018

Happens to me as well with pandas

File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)
  File "pandas\_libs\tslib.pyx", line 1510, in init pandas._libs.tslib
AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute '__reduce_cython__'
@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder May 4, 2018

Contributor

@chriscainx: it looks like you're not importing the module from its package but directly as a top-level module from its package directory. It should work if you import it correctly instead. It might be possible to improve something here, but I wouldn't consider it a priority.

@eliaperantoni: Not sure what PyInstaller does different from a normal Python import here. Could you please investigate?

EDIT: #2252 (comment) has the complete PyInstaller stack trace.

Contributor

scoder commented May 4, 2018

@chriscainx: it looks like you're not importing the module from its package but directly as a top-level module from its package directory. It should work if you import it correctly instead. It might be possible to improve something here, but I wouldn't consider it a priority.

@eliaperantoni: Not sure what PyInstaller does different from a normal Python import here. Could you please investigate?

EDIT: #2252 (comment) has the complete PyInstaller stack trace.

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni May 4, 2018

@scoder """Solved""" by removing pandas import which I was actually not using, could that be issue? Importing a module but not using it?

EDIT: Nevermind, I get the same error even without importing pandas or having it installed in the virtualenv at all 🤔. I tried with pyinstaller main.py --clean -F but no luck

eliaperantoni commented May 4, 2018

@scoder """Solved""" by removing pandas import which I was actually not using, could that be issue? Importing a module but not using it?

EDIT: Nevermind, I get the same error even without importing pandas or having it installed in the virtualenv at all 🤔. I tried with pyinstaller main.py --clean -F but no luck

@Hellcat1005

This comment has been minimized.

Show comment
Hide comment
@Hellcat1005

Hellcat1005 May 10, 2018

@eliaperantoni I got AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute 'reduce_cython' as well. I solved this problem by using pandas-0.20.3, cython-0.27.3 and python-3.5.

Hellcat1005 commented May 10, 2018

@eliaperantoni I got AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute 'reduce_cython' as well. I solved this problem by using pandas-0.20.3, cython-0.27.3 and python-3.5.

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni May 10, 2018

@Hellcat1005 It worked, now I'm getting a "DLL load failed" thought, I'll try to sort it out

eliaperantoni commented May 10, 2018

@Hellcat1005 It worked, now I'm getting a "DLL load failed" thought, I'll try to sort it out

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni May 10, 2018

@Hellcat1005 I solved the DLL error but now I'm getting

AttributeError: type object 'scipy.interpolate.interpnd.array' has no attribute '__reduce_cython__'

which I didn't find a github issue for and I have no idea how to solve.
At this point I think I'm just going to bundle the application another way

eliaperantoni commented May 10, 2018

@Hellcat1005 I solved the DLL error but now I'm getting

AttributeError: type object 'scipy.interpolate.interpnd.array' has no attribute '__reduce_cython__'

which I didn't find a github issue for and I have no idea how to solve.
At this point I think I'm just going to bundle the application another way

@xianweilv

This comment has been minimized.

Show comment
Hide comment
@xianweilv

xianweilv May 18, 2018

@eliaperantoni I have the same problem with you. Have you solved it?
AttributeError: type object 'scipy.interpolate.interpnd.array' has no attribute '__reduce_cython__'

xianweilv commented May 18, 2018

@eliaperantoni I have the same problem with you. Have you solved it?
AttributeError: type object 'scipy.interpolate.interpnd.array' has no attribute '__reduce_cython__'

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni commented May 18, 2018

No, not yet

@Dnlah

This comment has been minimized.

Show comment
Hide comment
@Dnlah

Dnlah May 21, 2018

Any updates? I'm having a similar issue and can't seem to figure out what is wrong.

Dnlah commented May 21, 2018

Any updates? I'm having a similar issue and can't seem to figure out what is wrong.

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni May 22, 2018

No updates sorry :(

eliaperantoni commented May 22, 2018

No updates sorry :(

@szymonmaszke

This comment has been minimized.

Show comment
Hide comment
@szymonmaszke

szymonmaszke May 24, 2018

@eliaperantoni @xianweilv Import scipy.interpolate.interpnd in your script somewhere, it will fix it. You could create a hook for it, I got not luck with that though.

szymonmaszke commented May 24, 2018

@eliaperantoni @xianweilv Import scipy.interpolate.interpnd in your script somewhere, it will fix it. You could create a hook for it, I got not luck with that though.

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni May 24, 2018

Ok that solved the issue but now I'm getting the fourth error...
File "messagestream.pxd", line 5, in init scipy.spatial.qhull
ModuleNotFoundError: No module named 'scipy._lib.messagestream'

eliaperantoni commented May 24, 2018

Ok that solved the issue but now I'm getting the fourth error...
File "messagestream.pxd", line 5, in init scipy.spatial.qhull
ModuleNotFoundError: No module named 'scipy._lib.messagestream'

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni May 24, 2018

Googling it, will post updates

eliaperantoni commented May 24, 2018

Googling it, will post updates

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni May 24, 2018

@szymonmaszke Finally got it to work on my machine, will have to test on a fresh one without python installed. Here's the full command

pyinstaller server.py --paths .\env\Lib\site-packages\scipy\extra-dll --hidden-import scipy._lib.messagestream -F

eliaperantoni commented May 24, 2018

@szymonmaszke Finally got it to work on my machine, will have to test on a fresh one without python installed. Here's the full command

pyinstaller server.py --paths .\env\Lib\site-packages\scipy\extra-dll --hidden-import scipy._lib.messagestream -F
@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder May 25, 2018

Contributor

Could this problem be related to a cyclic import? I.e. a module being reimported elsewhere while its module init function is still executing?

Contributor

scoder commented May 25, 2018

Could this problem be related to a cyclic import? I.e. a module being reimported elsewhere while its module init function is still executing?

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder May 25, 2018

Contributor

To clarify: there are multiple different cases in this ticket. I can see at least three different setups that suggest different reasons for this to occur. The initially described module reinitialisation is definitely an issue by its own, so I'm trying to find out what might cause the other reports.

Contributor

scoder commented May 25, 2018

To clarify: there are multiple different cases in this ticket. I can see at least three different setups that suggest different reasons for this to occur. The initially described module reinitialisation is definitely an issue by its own, so I'm trying to find out what might cause the other reports.

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder May 27, 2018

Contributor

The underlying reason is most likely this: https://bugs.python.org/issue32973

Contributor

scoder commented May 27, 2018

The underlying reason is most likely this: https://bugs.python.org/issue32973

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder May 27, 2018

Contributor

BTW, there is a work-around for that CPython issue in 0.28+, see c872937
Could the people in this thread please make sure they have tried the latest release, so that I can be sure that it does not solve the problem?

Contributor

scoder commented May 27, 2018

BTW, there is a work-around for that CPython issue in 0.28+, see c872937
Could the people in this thread please make sure they have tried the latest release, so that I can be sure that it does not solve the problem?

@nicoddemus

This comment has been minimized.

Show comment
Hide comment
@nicoddemus

nicoddemus May 29, 2018

I was having this same problem with scipy 1.0.1, but updating to 1.1.0 (which I suppose uses a newer cpython) fixed this for me. 👍

nicoddemus commented May 29, 2018

I was having this same problem with scipy 1.0.1, but updating to 1.1.0 (which I suppose uses a newer cpython) fixed this for me. 👍

@jh0w3l05

This comment has been minimized.

Show comment
Hide comment
@jh0w3l05

jh0w3l05 Jun 14, 2018

Having 'somehow' the same error:
AttributeError: type object 'cytoolz.itertoolz.remove' has no attribute 'reduce_cython'
pyinstaller_attributeerror

I'm using the ff:
Conda 4.5.4
Python 3.5.5
Cython 0.28.3
Scipy 1.1.0

@eliaperantoni or anyone who has an idea:
How did you get an extra-dll on your scipy installation?
On my current scipy install I do not have that.
Thanks.

jh0w3l05 commented Jun 14, 2018

Having 'somehow' the same error:
AttributeError: type object 'cytoolz.itertoolz.remove' has no attribute 'reduce_cython'
pyinstaller_attributeerror

I'm using the ff:
Conda 4.5.4
Python 3.5.5
Cython 0.28.3
Scipy 1.1.0

@eliaperantoni or anyone who has an idea:
How did you get an extra-dll on your scipy installation?
On my current scipy install I do not have that.
Thanks.

@eliaperantoni

This comment has been minimized.

Show comment
Hide comment
@eliaperantoni

eliaperantoni Jun 18, 2018

@jh0w3l05 Nothing fancy really. I created a virtual environment and installed scipy. The full path is:
project_folder/env/env/Lib/site-packages/scipy/extra-dll

eliaperantoni commented Jun 18, 2018

@jh0w3l05 Nothing fancy really. I created a virtual environment and installed scipy. The full path is:
project_folder/env/env/Lib/site-packages/scipy/extra-dll

@scoder scoder added this to the 0.28 milestone Jun 18, 2018

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Jun 18, 2018

Contributor

@jh0w3l05, just having Cython version x.y installed on your system is entirely irrelevant if a certain package that you install was built with an older Cython version that has a bug.

I'll close this ticket now, since the cause was fixed with 0.28. Please open a new ticket if you find a similar problem that occurs in software that was built with 0.28 or later.

Edit: to verify that a Cython implemented package was built with the correct(ed) Cython version, unpack its source distribution (*.tar.gz from PyPI), find the .c or .cpp files in it and look at their first line. If it says /* Generated by Cython 0.28 */ or a later version, it includes the fix. If the version is older, it does not include the fix, in which case it's best to ask the project for a new release.

Contributor

scoder commented Jun 18, 2018

@jh0w3l05, just having Cython version x.y installed on your system is entirely irrelevant if a certain package that you install was built with an older Cython version that has a bug.

I'll close this ticket now, since the cause was fixed with 0.28. Please open a new ticket if you find a similar problem that occurs in software that was built with 0.28 or later.

Edit: to verify that a Cython implemented package was built with the correct(ed) Cython version, unpack its source distribution (*.tar.gz from PyPI), find the .c or .cpp files in it and look at their first line. If it says /* Generated by Cython 0.28 */ or a later version, it includes the fix. If the version is older, it does not include the fix, in which case it's best to ask the project for a new release.

@scoder scoder closed this Jun 18, 2018

@cschramm

This comment has been minimized.

Show comment
Hide comment
@cschramm

cschramm Jun 19, 2018

I can confirm that I cannot replicate my issue with 0.28.3 anymore. 👍

cschramm commented Jun 19, 2018

I can confirm that I cannot replicate my issue with 0.28.3 anymore. 👍

@taosean

This comment has been minimized.

Show comment
Hide comment
@taosean

taosean Jul 6, 2018

@jh0w3l05 I have the same error as yours. Have you solved this problem? I was packaging an caffe project to a .exe file using pyinstaller. The code is pyinstaller -F runcaffe_fpn.py, however, the runcaffe_fpn.exe file I got shows the following error.
default

taosean commented Jul 6, 2018

@jh0w3l05 I have the same error as yours. Have you solved this problem? I was packaging an caffe project to a .exe file using pyinstaller. The code is pyinstaller -F runcaffe_fpn.py, however, the runcaffe_fpn.exe file I got shows the following error.
default

@nicoddemus

This comment has been minimized.

Show comment
Hide comment
@nicoddemus

nicoddemus Jul 6, 2018

@taosean the libraries you use or depend on that use Cython should be compiled with 0.28+, see #1953 (comment).

nicoddemus commented Jul 6, 2018

@taosean the libraries you use or depend on that use Cython should be compiled with 0.28+, see #1953 (comment).

@taosean

This comment has been minimized.

Show comment
Hide comment
@taosean

taosean Jul 9, 2018

@nicoddemus Thank you for your reply. Just as you suggested, I updated my cython to 0.28.3 and recompiled my .pyx file to get .pyd file, and also, I recompiled my caffe with python which installed cython 0.28.3. However, I got no luck and still got the same error. Below is the detailed traceback, any ideas? Thanks!
default

Update

I searched on Google and it seemed to be a problem of caffe.io.py calling skimage.imread function to input an image. I replaced skimage.io.imread with cv2.imread and the error won't show again. For more details, please refer to this article

taosean commented Jul 9, 2018

@nicoddemus Thank you for your reply. Just as you suggested, I updated my cython to 0.28.3 and recompiled my .pyx file to get .pyd file, and also, I recompiled my caffe with python which installed cython 0.28.3. However, I got no luck and still got the same error. Below is the detailed traceback, any ideas? Thanks!
default

Update

I searched on Google and it seemed to be a problem of caffe.io.py calling skimage.imread function to input an image. I replaced skimage.io.imread with cv2.imread and the error won't show again. For more details, please refer to this article

@glorioushedgehog

This comment has been minimized.

Show comment
Hide comment
@glorioushedgehog

glorioushedgehog Jul 13, 2018

I've been getting the pyinstaller interpnd error with Scipy 1.1.0, which I need to use tensorlayer. Here is the end of the stack trace:

File "site-packages\scipy\interpolate\interpolate.py", line 32, in <module> File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 656, in _load_unlocked File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible File "c:\users\paul\insightface_tf\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module module = loader.load_module(fullname) File "stringsource", line 104, in init scipy.interpolate.interpnd AttributeError: type object 'scipy.interpolate.interpnd.array' has no attribute '__reduce_cython__'

I've tried all the solutions offered here. Since Scipy 1.1.0 worked for @nicoddemus , I don't know what else could be going wrong. I'm using python 3.6.6.

glorioushedgehog commented Jul 13, 2018

I've been getting the pyinstaller interpnd error with Scipy 1.1.0, which I need to use tensorlayer. Here is the end of the stack trace:

File "site-packages\scipy\interpolate\interpolate.py", line 32, in <module> File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 656, in _load_unlocked File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible File "c:\users\paul\insightface_tf\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module module = loader.load_module(fullname) File "stringsource", line 104, in init scipy.interpolate.interpnd AttributeError: type object 'scipy.interpolate.interpnd.array' has no attribute '__reduce_cython__'

I've tried all the solutions offered here. Since Scipy 1.1.0 worked for @nicoddemus , I don't know what else could be going wrong. I'm using python 3.6.6.

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Jul 14, 2018

Contributor

Since further comments on this ticket seem unhelpful and make the relevant comments harder to find, I'll lock the issue. Please read #1953 (comment)

Contributor

scoder commented Jul 14, 2018

Since further comments on this ticket seem unhelpful and make the relevant comments harder to find, I'll lock the issue. Please read #1953 (comment)

@cython cython locked as resolved and limited conversation to collaborators Jul 14, 2018

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Aug 1, 2018

Contributor

One more thing to add, since it came up along the way: calling Py_Initialize() after Py_Finalize() is not actually supported in CPython: https://bugs.python.org/issue34309

Contributor

scoder commented Aug 1, 2018

One more thing to add, since it came up along the way: calling Py_Initialize() after Py_Finalize() is not actually supported in CPython: https://bugs.python.org/issue34309

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.