Error while importing igraph - python

I am using Python 3.6 on Windows 7 and I have a problem with the igraph package. I was having errors while I was trying to install it using pip, so I decided to install it from the .whl file. Unfortunately, I couldn't find version appropriate for Python 3.6, so I downloaded another version and changed the name of the file so that it looked like it was designed for Python 3.6. The installation was successful, but when I am trying to run a script which uses the igraph module - a following error message appears:
Traceback (most recent call last):
File "C:/Users/Jarek/Documents/Studia/Programowanie/Python na studiach/Analysis of Unstructured Data/List2.py", line 6, in <module>
import igraph as ig
File "C:\Users\Jarek\AppData\Local\Programs\Python\Python36-32\lib\site-packages\igraph\__init__.py", line 34, in <module>
from igraph._igraph import *
ModuleNotFoundError: No module named 'igraph._igraph'
I haw a very similar issue under Python igraph import error on Windows
but there was no answer there. I have also seen
No module named 'igraph._igraph' but suggestion given there does not help me (or I do not know how to properly apply it).
Any help will be greatly appreciated. Thanks in advance.

I couldn't find version appropriate for Python 3.6, so I downloaded another version and changed the name of the file so that it looked like it was designed for Python 3.6.
So the trick didn't work. Use Python 2.6 or 2.7. Or compile from sources.

Related

Linux terminal and Python are mushed together

When I run some commands, which work, for example neofetch, it gives me a Python error.
username#host:~$ as
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in <module>
from CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
from CommandNotFound.db.db import SqliteDatabase
File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
It does that whenever I type an invalid command. This started happening after I installed Python 3.9. I am running Kubuntu with Python 3.10 installed by default.
Modern Linux distributions tend to use a lot of python scripts for internal use; for this reason python gets installed with a plethora of libraries.
The error you are getting is because you replaced that fairly complete system python with a version of your own choosing without providing all the libraries the original came with.
The error you see is emitted by /usr/lib/command-not-found, a script using python3 as found in the system path.
I strongly recommend that you re-install the original python packages and use e.g. anaconda for your specific python needs.
The main takeaway from this is:
DON'T MESS WITH THE SYSTEM PYTHON.
try to find which python are you using using which python and uninstall the first python interpreter it finds.

ModuleNotFoundError, even after pip install

I have recently bought a new laptop and was viewing some python projects of mine which I made on my pc. For one of them I use the python-bitvavo-api library which I installed using pip3 install python-bitvavo-api. The version I installed is 1.2.2 which is the latest on their website.
Now when I try to import it using this code: from python_bitvavo_api.bitvavo import Bitvavo, I get the following error:
Traceback (most recent call last):
File "C:\Users\indig\OneDrive\Documenten\Python Projects\Personal\Cryptone\Cryptone.py", line 6, in <module>
from python_bitvavo_api.bitvavo import Bitvavo
ModuleNotFoundError: No module named 'python_bitvavo_api'
I read online that it may occur when using multiple python versions, Im only using 1 and thats python 3.7
Btw. I have the same error with the Pillow module, so it might be a setting in visual studio that I dont know of. Anyway, someone please help. If you need more details please ask.
How are you running it? From the terminal or from VS?
You can also check the installed libraries running the command pip list

Why "ImportError: No module named builtins" appears after importing hive from PyHive package?

I have a simple question to ask. I have been trying to execute HIVE queries from Python using impyla package. But I stuck into cursor problem, already a question has been asked on stackoverflow. In this question, a user answered and advised to use PyHive instead.
Therefore, now I am trying to execute HIVE queries from Python using PyHive. But unluckily, I am stuck at another issue which seems to be not that complicated. As soon as I execute the following line in python I get an error:
In [18]: from pyhive import hive
Traceback (most recent call last):
File "<ipython-input-18-747088b97eb4>", line 1, in <module>
from pyhive import hive
File "build\bdist.win32\egg\pyhive\hive.py", line 13, in <module>
File "build\bdist.win32\egg\pyhive\common.py", line 8, in <module>
ImportError: No module named builtins
Can anyone indicate where I am getting it wrong? Since, I have already successfully installed the PyHive package on my machine, so I don't expect this to appear. I have been searching allot to find a reason of this error. It will be really a great time saver if I know the solution today. Thank you very much for your time and support.
UPDATE
I am using:
Windows 7 (64-bit)
Python 2.7 (32-bit)
Anaconda2 4.1.1 (32-bit)
In python 3 the module __builtin__ was renamed to builtins.
It is possible that you have installed a python 3 package and are trying to run it with python 2.

Panda 3D Python import error on OSX

I have been messing around with Python/Panda3D and trying to get my first file to run. I am on OSX and after installing Panda3D I tried to run this file:
import direct.directbase.DirectStart
run()
That was followed by this on the Terminal output:
$ python core.py
Traceback (most recent call last):
File "core.py", line 2, in <module>
import direct.directbase.DirectStart
ImportError: No module named direct.directbase.DirectStart
I have been searching everywhere, but all the forms don't really solve the problem. Any help would be awesome!
Thanks!
This is usually a problem when you're using a version of Python other than the one Panda3D is compiled with. If you are using the 1.9.0 Lion build of Panda3D, make sure you are using the system-provided copy of Python 2.7, by explicitly running "python2.7" or "ppython" (which should be a symlink to the correct version of Python).

How can I use Numerical Python with Python 2.6

I'm forced to upgrade to Python 2.6 and am having issues using Numerical Python (NumPy) with Python 2.6 in Windows. I'm getting the following error...
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from numpy.core.numeric import array,dot,all
File "C:\svn\svn_urbansim\UrbanSimDev\Builds\working\urbansim\Tools\Python26\lib\site-packages\numpy\__init__.py", line 39, in <module>
import core
File "C:\svn\svn_urbansim\UrbanSimDev\Builds\working\urbansim\Tools\Python26\lib\site-packages\numpy\core\__init__.py", line 5, in <module>
import multiarray
ImportError: Module use of python25.dll conflicts with this version of Python.
It appears that the existing module is trying to use the python25.dll file. Is there any way I can tell it to use the python26.dll file instead without modifying the source code?
How did you install it? NumPy doesn't currently have a Python 2.6 binary.
If you have LAPACK/ATLAS/BLAS, etc. and a development environment you should be able to compile numpy from sources. Otherwise I think you're stuck with using Python 2.5 on Windows if you need NumPy.
The next version of NumPy should have a 2.6 binary, and it's likely to be out within the next month or so.
[Edit]: It appears that a pygame developer created a NumPy 1.2.1 binary for Python 2.6 on Windows, available here.
NumPy 1.3.0 is available for Python 2.6 now.

Categories

Resources