Python Forum

Full Version: Trying to setup Python application, odd error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Although python3 cannot find the Cython module:

[inline] python3 setup.py
Could not import cx_Freeze. Building executable not possible.
Traceback (most recent call last):
File "setup.py", line 13, in <module>
from Cython.Build import cythonize
ImportError: No module named 'Cython'[/inline]

pip3 says it has been installed:
[inline]
pip3 install Cython
Requirement already satisfied (use --upgrade to upgrade): Cython in /usr/local/lib/python3.4/dist-packages
Cleaning up...[/inline]

What is going on? How do I fix this?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Some more relevant information:
Pip version:

[inline] pip3 -V
pip 1.5.4 from /usr/lib/python3/dist-packages (python 3.4)[/inline]

Python version:

[inline] python3 -V
Python 3.4.6[/inline]

Tried to install from within Python session:

[inline] python3
Python 3.4.6 (default, May 11 2017, 18:25:35)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import Cython
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'Cython'
>>> sys.executable
'/usr/local/bin/python3'
>>> exit()

python3 -m pip install module
/usr/local/bin/python3: No module named pip

python3 -m pip Cython
/usr/local/bin/python3: No module named pip

sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version.
The following packages were automatically installed and are no longer required:
libgsoap4 libvncserver0
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 189 not upgraded.[/inline]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I tried cutting and pasting the stuff in /usr/local/lib/python3.4/dist-packages to /usr/local/lib/python3.4, but I end up with weird errors, like this:

[inline] Traceback (most recent call last):
File "setup.py", line 13, in <module>
from Cython.Build import cythonize
File "/usr/local/lib/python3.4/Cython/Build/__init__.py", line 1, in <module>
from .Dependencies import cythonize
File "/usr/local/lib/python3.4/Cython/Build/Dependencies.py", line 51, in <module>
from ..Compiler.Main import Context, CompilationOptions, default_options
File "/usr/local/lib/python3.4/Cython/Compiler/Main.py", line 30, in <module>
from .Symtab import ModuleScope
File "/usr/local/lib/python3.4/Cython/Compiler/Symtab.py", line 18, in <module>
from . import PyrexTypes
File "/usr/local/lib/python3.4/Cython/Compiler/PyrexTypes.py", line 17, in <module>
from .Code import UtilityCode, LazyUtilityCode, TempitaUtilityCode
ImportError: /usr/local/lib/python3.4/Cython/Compiler/Code.cpython-34m.so: undefined symbol: PyFPE_jbuf[/inline]

I am on Linux Mint Cinnamon 64-bit.
you list off responses from directories...
  • /usr/local/lib/python3.4 
  • /usr/local/bin/python3 
  • /usr/lib/python3 
/usr/lib/python3 and /usr/local/lib/python3.4 are not the same. local is for locally installed programs or programs you did not install with a package manager (ie. apt-get. So you must have numerous python installations, may or may not be the same version, but one with pip/cython and one without. One in /usr/bin and at least another one in /usr/local/bin
 
Quote:I tried cutting and pasting the stuff in /usr/local/lib/python3.4/dist-packages to /usr/local/lib/python3.4,
I would not do anything like this. First of all dist-packages are where 3rd party libs go for python. Secondly, if you cut and paste other stuff like i would restart with a fresh new install of python3.X and start back at square one. Do not remove python2.x as it can mess your system up.

Also it appears you might of symlinked your python3 to your local directory or an alias?
(Jul-31-2017, 01:00 AM)metulburr Wrote: [ -> ]you list off responses from directories...
  • /usr/local/lib/python3.4 
  • /usr/local/bin/python3 
  • /usr/lib/python3 
/usr/lib/python3 and /usr/local/lib/python3.4 are not the same. local is for locally installed programs or programs you did not install with a package manager (ie. apt-get. So you must have numerous python installations, may or may not be the same version, but one with pip/cython and one without. One in /usr/bin and at least another one in /usr/local/bin
 
Quote:I tried cutting and pasting the stuff in /usr/local/lib/python3.4/dist-packages to /usr/local/lib/python3.4,
I would not do anything like this. First of all dist-packages are where 3rd party libs go for python. Secondly, if you cut and paste other stuff like i would restart with a fresh new install of python3.X and start back at square one. Do not remove python2.x as it can mess your system up.

Also it appears you might of symlinked your python3 to your local directory or an alias?

How do I reinstall Python 3? sudo apt-get remove --purge does not work.
Hello? Is there anyone who knows how to reinstall Python 3?
See @snippsat's answer on this post https://python-forum.io/Thread-Interpete...aller-help
I want to reinstall it, not install an alternative.
You should try to uninstall and delete anything related to python, then do a new reinstall. It is quite annoying and frustrating, however with the right guide, you can fix the problem you are having. You can try reading this article by SIITGo.