Skip to content
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

Problems importing _pycat? #2

Closed
gvoysey opened this issue Oct 9, 2014 · 10 comments
Closed

Problems importing _pycat? #2

gvoysey opened this issue Oct 9, 2014 · 10 comments

Comments

@gvoysey
Copy link

gvoysey commented Oct 9, 2014

First, thanks for this! I saw the announcement come across the auditory list, and have gotten the time to check it out. (Greetings from BU!)

I'm running into what is probably a configuration issue, so my apologies for what may be a stupid question.

I've set up anaconda 32-bit on a windows 7 x64 box, running python 2.7.x. I'm running cochlea under the debugger, using PyCharm as my IDE. I've cloned both cochlea and thorns, and they reside in C:/Projects/cochlea

Running examples\run_zilany2014.py results in the following:

"C:\Users\gvoysey\Anaconda\python.exe" C:/Projects/cochlea/cochlea/examples/run_zilany2014_rate.py
Traceback (most recent call last):
File "C:/Projects/cochlea/cochlea/examples/run_zilany2014_rate.py", line 42, in <module>
     import cochlea
File "C:\Projects\cochlea\cochlea\cochlea\__init__.py", line 30, in <module>
from cochlea.zilany2009 import run_zilany2009
File "C:\Projects\cochlea\cochlea\cochlea\zilany2009\__init__.py", line 28, in <module>
from . import _pycat
ImportError: cannot import name _pycat

I'm not sure why this may be. Any thoughts?

@mrkrd
Copy link
Owner

mrkrd commented Oct 10, 2014

Graham Voysey notifications@github.com writes:

First, thanks for this! I saw the announcement come across the
auditory list, and have gotten the time to check it out. (Greetings
from BU!)

Great! I'm really happy that you are trying it out. Greetings from TUM ;)

I'm running into what is probably a configuration issue, so my
apologies for what may be a stupid question.

Thank you for time and the feedback. It's very useful, because there's
probably a dozen of people that got stuck at a similar issue. I'll try
to document it better.

I've set up anaconda 32-bit on a windows 7 x64 box, running python
2.7.x. I'm running cochlea under the debugger, using PyCharm as my
IDE. I've cloned both cochlea and thorns, and they reside in
C:/Projects/cochlea

Running examples\run_zilany2014.py results in the following:

"C:\Users\gvoysey\Anaconda\python.exe" C:/Projects/cochlea/cochlea/examples/run_zilany2014_rate.py
Traceback (most recent call last):
File "C:/Projects/cochlea/cochlea/examples/run_zilany2014_rate.py", line 42, in <module>
     import cochlea
File "C:\Projects\cochlea\cochlea\cochlea\__init__.py", line 30, in <module>
from cochlea.zilany2009 import run_zilany2009
File "C:\Projects\cochlea\cochlea\cochlea\zilany2009\__init__.py", line 28, in <module>
from . import _pycat
ImportError: cannot import name _pycat

I'm not sure why this may be. Any thoughts?

I guess that the issue is with 32-bit Python. I compiled and uploaded
the package for 64-bit version on Windows. The easiest way to fix it,
would be to install 64-bit version of Anaconda. You might need to
deinstall cochlea and install it from PyPI (pip install cochlea).

Quick way to test the package is to run examples/run_zilany2014.py .

Please, tell me, if it worked. Thank you!

Marek

@mrkrd
Copy link
Owner

mrkrd commented Oct 21, 2014

Hi Graham, did you manage to run cochlea with 64-bit version of Python? Thanks for your feedback!

@gvoysey
Copy link
Author

gvoysey commented Oct 28, 2014

Hi Marek,

Using the 64-bit anaconda on windows 7, I'm still getting import errors on __pycat. I'm not very familiar with the cythonic way of using *.pyx files -- should I be using something like this ?

 import pyximport
 pyximport.install()

@mrkrd
Copy link
Owner

mrkrd commented Oct 29, 2014

Using the 64-bit anaconda on windows 7, I'm still getting import
errors on __pycat. I'm not very familiar with the cythonic way of
using *.pyx files -- should I be using something like this ?

 import pyximport
 pyximport.install()

_pycat is a binary sub-module implemented in C/Cython, part of cochlea.
It seems that your installation of cochlea is not complete.

Try to (re)install it with only 64-bit version of Python (Anaconda):

pip install cochlea

or perhaps:

pip install --ignore-installed cochlea

The point is that pip should pull the wheel pre-compiled binary package
(cochlea-1.2-cp27-none-win_amd64.whl at the moment) from PyPI and not
the tar.gz source package. The problem is that is not trivial to
compile things in Windows and trying to install from source usually
fails. That's why I uploaded the binary wheel file. I think you can
read in the output of pip program, what's being downloaded and
installed.

@gvoysey
Copy link
Author

gvoysey commented Oct 29, 2014

Alright, i'll have another go.

Part of what's getting me into trouble here is that i have been attempting to replicate your devel environment, and run cochlea from its source tree under an IDE, rather than actually installing it. This absolutely works in my normal world (c#), but may not be the pythonic way of doing things.

@gvoysey
Copy link
Author

gvoysey commented Oct 30, 2014

Okay. I've now set up my usual "installed package" configuration for python on win7/64, which is using WinPython and virtualenv. I copied over the examples folder, and have now successfully run run_zilany_2014.py.

N.B. for other windows users following virtualenv best practices: pypa/virtualenv#93 applies here. I found that adding

 set TCL_LIBRARY=C:\Path\To\Your\Python27\tcl\tcl8.5
 set TK_LIBRARY=C:\Path\To\Your\Python27\tcl\tk8.5

to activate.bat did the trick.

@gvoysey gvoysey closed this as completed Oct 30, 2014
@mrkrd
Copy link
Owner

mrkrd commented Oct 30, 2014

Graham Voysey notifications@github.com writes:

Alright, i'll have another go.

Part of what's getting me into trouble here is that i have been
attempting to replicate your devel environment, and run cochlea from
its source tree under an IDE, rather than actually installing it.
This absolutely works in my normal world (c#), but may not be the
pythonic way of doing things.

Great, I saw, that you managed to install cochlea from the
pre-compiled package.

I wrote a few instructions how to reproduce the development environment
on Windows:

https://pythonhosted.org/cochlea/installation.html#installation-from-source-code-on-windows

Hope that's helpful and thank you for your feedback so far.

@Huitzilo
Copy link

Huitzilo commented Dec 8, 2018

I know I risk waking a zombie here, however I ran into the same issue trying to run cochlea on macOS. I first built from source and received the above error that the _pycat could not be found.
Installing from pip didn't resolve the issue.
Digging a bit deeper I found that _pycat.so is present in build/lib.macosx-10.6-x86_64-2.7/, but somehow the build process doesn't seem to copy it over to the target directory.

@mrkrd
Copy link
Owner

mrkrd commented Dec 11, 2018 via email

@Huitzilo
Copy link

There are no hints in the output of setup.py install. It simply ignores _pycat.so.
python setup.py develop works, thank you for the workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants