Cannot Unpickle my model after Reinstalling Python - python

I used pickle for a few months to save my ML-models and was able to load them without any problems but recently after Reinstalling Windows and Python I am getting this error message when I try to load the exact same model:
AttributeError: type object 'sklearn.neighbors.ball_tree.NeighborsHeap' has no attribute '__reduce_cython__'
Does anyone know what is causing this?
I used Python 3.6 (64bit) before and I am using the same one right now.

Most probably, you are using a different version of sklearn.
According to search results for __reduce_cython__ in Cython's codebase, it's added by Cython to some compiled types to make __reduce__ work correctly or something. So its absense likely means changes in the affected classes or their hierarchy.

Related

AttributeError: 'gdstk.Cell' object has no attribute 'get_polygons'

I am new in PIC design and I want to make a simple GDSII design following this script:
https://github.com/BYUCamachoLab/simphony/blob/master/examples/layout_aware.py
which uses gdsfactory and simphony libraries but I consistently encounter this error when I am building a cell:
AttributeError: 'gdstk.Cell' object has no attribute 'get_polygons'
This problem appears when I try to call the grating coupler or the waveguides as a component. On the other hand, the Ybranch (splitters) work just fine.
I have downloaded all the latest versions of gdstk, gdsfactory and simphony but cannot make it work.
Do you know how to overcome this issue? What am I missing?
Thanks!
Solved. In case anybody finds in the same situation, the problem was with the gdstk library. For whatever reason, the version installed could not be changed and it remained always in 7.0.
By reinstalling Anaconda, the gdstk latest version could be installed without issues, and from there the program worked.

AttributeError: module 'networkx.algorithms' has no attribute 'smallworld' when I try to use NetworkX's Small-World module

I was trying to use NetworkX's sigma function to get the small-world coefficient of a graph. The documentation states here that that can be found in: networkx.algorithms.smallworld.sigma
However, if I try to perform the following call:
nx.algorithms.smallworld.sigma(G)
I get the following error:
AttributeError: module 'networkx.algorithms' has no attribute 'smallworld'
Also, Spyder's Intellisense does not seem to be aware of that package. (I'm using Python 3.6.5, NetworkX 2.5.1, and Spyder 3.2.8; for the record, yes, I do know that that's an old version of Spyder).
I'm slightly confused because I'm able to do calls like:
nx.algorithms.community.girvan_newman(G)
nx.algorithms.cluster.average_clustering(G)
In those cases, the modules are exactly where the documentation says they'll be.
I am aware that the cource code for this can be found here. However, I would prefer not to have to manually add this to my project.
Can anyone point out my mistake (or suggest a workaround so that I don't have to add the code to my project manually)?

I got a trio input function from a friend and it's trying to use trio.lowleve.FdStream, however I can't find it

I'm getting this error: AttributeError: module 'trio.lowlevel' has no attribute 'FdStream'. FdStream isn't in the trio code on git nor in my installation. Is there an alternative to this, or is there a different version I did't find?
That attribute is only available on non-Windows platforms. If your friend made the function compatible with only Linux/macos, you will need to run the function on a Posix platform as well.

'LookupAlignConvolution2d' no object '_convolution_op' attribute error

I have been working with the project tf-lcnn (https://github.com/ildoonet/tf-lcnn). I have built tensorflow from sources (1.4.1) and I am using python3 to run the command python3 train.py. This issue is that when I run said command I get:
AttributeError: 'LookupAlignConvolution2d' object has no attribute '_convolution_op'
I have tried tensorflow versions(1.3 and 1.4) and nothing gets the project to work. The custom_op was linked properly and works. The instructions from the project don't state that you have to follow his instructions first then build tensorflow. He also doesn't express the configuration build that he used.
I have tried some different approaches but I am sure there is something I am missing or doing wrong. Any help would be appreciated. I can post additional information upon request. Thanks in advance!

PyUnicodeUCS2_* error while importing VTK

I've run into a strange problem.
I built VTK with python wrappings on cent os 6.5.
On importing vtk it gives me PyUnicodeUCS2_* error. I checked python used for the build for unicode setting with sys.maxunicode. It is UCS4. I searched for this error and found that the error occurs when the VTK is built using UCS2 python. But, This is not the case in my case. What could be the reason for error?
The python that I'm using is picked from some other machine . If I run maxunicode on original previous machine it shows USC2. The same python (I copied the whole folder python2.6) on the other machine where I'm building VTK, shows maxunicode as UCS4. I think this has something to do with the problem.
Please help.
This error is caused by using an extension built by a UCS2-based Python interpreter with a UCS4-based interpreter (or vice-versus).
If you built it using the same Python interpreter then something is confusing in your build environment.
I tried to compile VTK with my python build several times. Checked the various paths in CMAKE to avoid conflict with system python. Still couldn't get rid of the error. Finally, I built the python with --enable-unicoe=ucs2. That solved the problem. Thanks for the help though.

Categories

Resources