I am trying to import igraph but it keeps throwing this error at me:
>>> import igraph
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/igraph/__init__.py",
line 36, in <module>
from igraph.clustering import *
File "/usr/local/lib/python3.6/site-packages/igraph/clustering.py",
line 36, in <module>
from igraph.drawing.colors import ClusterColoringPalette
File "/usr/local/lib/python3.6/site-
packages/igraph/drawing/__init__.py", line 27, in <module>
from igraph.drawing.graph import DefaultGraphDrawer
File "/usr/local/lib/python3.6/site-
packages/igraph/drawing/graph.py", line 27, in <module>
from igraph.drawing.edge import ArrowEdgeDrawer
File "/usr/local/lib/python3.6/site-packages/igraph/drawing/edge.py",
line 17, in <module>
cairo = find_cairo()
File "/usr/local/lib/python3.6/site-
packages/igraph/drawing/utils.py", line 413, in find_cairo
module = __import__(module_name)
File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py",
line 41, in <module>
cairo = dlopen(ffi, 'cairo', 'cairo-2')
File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py",
line 38, in dlopen
raise OSError("dlopen() failed to load a library: %s" % ' /
'.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2
I have tried to follow this guide to install cairo but it throws this error and doesn't solve the igraph import issue: error: mandatory image surface backend feature could not be enabled
I have also tried to install pycairo but that resulted in no module founds: cairo, which brought me back to square one.
I tried running sudo port install cairo as per https://cairographics.org/download/ instructions. But that results in Error: Port cairo not found
My sys config:
MacOS High Sierra 10.13.1
Python 3.6
python-igraph 0.7.1
I am clueless as to what can be the issue. Any help would be highly appreciated. Thank you :)
Thanks to #Aiven I have managed to solve my issue. If anyone ever comes across the same problem, this have done the trick for me:
brew install cairo
brew install py2cairo
brew install igraph (install C-core)
sudo pip install python-igraph (install igraph for python)
Related
This is the full error message.
Traceback (most recent call last):
File "C:\Users\adi\OneDrive\Desktop\Python310\machine learning project.py", line 3, in <module>
import streamlit as st
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\__init__.py", line 70, in <module>
from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\delta_generator.py", line 19, in <module>
from streamlit import cursor, caching
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\cursor.py", line 18, in <module>
from streamlit.scriptrunner import get_script_run_ctx
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\scriptrunner\__init__.py", line 16, in <module>
from .script_runner import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 35, in <module>
from streamlit.state import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\state\__init__.py", line 27, in <module>
from .session_state_proxy import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\state\session_state_proxy.py", line 24, in <module>
from streamlit.type_util import Key
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\type_util.py", line 22, in <module>
import pyarrow as pa
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\pyarrow\__init__.py", line 65, in <module>
import pyarrow.lib as _lib
I am working with streamlit for a project but can't work out this problem.
I have tried uninstalling and reinstalling streamlit but that did'nt help.
i using python 3.8
Uninstalling and re-installing solved the issue for me:
pip uninstall pyarrow
pip install pyarrow
I think I messed things up by changing the Python version in my Conda environment.
You need to install pyarrow
python3 -m pip install pyarrow
Check these 2 things(worked for me) -
1-If you have changed your python version recently, uninstall all libraries then install.(can be done easily by pip uninstall -r requirements.txt -y & then pip install -r requirements.txt -y
2- If you have installed pyarrow in a different environment.
Operating system: Windows 10 Home
Python interpreter: Anaconda with python 3.8.8
I have installed the scipy module on anaconda using "conda install
scipy==1.6.2" and it states "# All requested packages already installed.". However, when I opened python ide and import scipy, the below error appears.
The way I try to solve is through reinstalling scipy module and "conda update --all". However, these all fails. Any ways to solve this issue. Thanks in advance.
import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\tys\.conda\envs\renv\lib\site-packages\scipy\__init__.py", line 130, in <module>
from . import _distributor_init
File "C:\Users\tys\.conda\envs\renv\lib\site-packages\scipy\_distributor_init.py", line 59, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\tys\.conda\envs\renv\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\tys\.conda\envs\renv\lib\site-packages\scipy\.libs\libbanded5x.3OIBJ6VWWPY6GDLEMSTXSIPCHHWASXGT.gfortran-win_amd64.dll' (or one of its dependencies). Try using the full path with constructor syntax.
You should try the solution given here (https://github.com/pytroll/satpy/issues/1835):
conda install -c defaults scipy
It worked for me.
Originally, Jupyter notebook was running well without any problems.
But after installing tensorflow and keras today, it doesn't work.
Error message:
Traceback (most recent call last):
File "C:\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 85, in <module>
from .services.contents.manager import ContentsManager
File "C:\Anaconda3\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File "C:\Anaconda3\lib\site-packages\nbformat\__init__.py", line 32, in <module>
from .validator import validate, ValidationError
File "C:\Anaconda3\lib\site-packages\nbformat\validator.py", line 12, in <module>
from .json_compat import get_current_validator, ValidationError
File "C:\Anaconda3\lib\site-packages\nbformat\json_compat.py", line 10, in <module>
import jsonschema
File "C:\Anaconda3\lib\site-packages\jsonschema\__init__.py", line 34, in <module>
__version__ = metadata.version("jsonschema")
AttributeError: module 'importlib_metadata' has no attribute 'version'
There is a problem with your importlib_metadata package, you can try uninstall it first and then forcing out a new installation with the following commands:
pip uninstall importlib_metadata
pip install importlib_metadata --force-reinstall
It worked for me.
This is a problem with the Anaconda version upgrade.
You can solve this with the following command that worked for me.
conda install -c conda-forge importlib_metadata
For me, the same error happened after VSCode proposed me to install a tensorboard plugin and I pressed yes. (MacOS 11.4, Conda 4.10.3)
It appears that it introduced some kind of version mismatch for multiple packages in the environment.
The following fixed the problem:
conda update --all
My environment specs
python --version
Python 3.7.6
anaconda --version
anaconda Command line client (version 1.7.2)
sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.2
BuildVersion: 19C57
I installed camelot from conda-forge
using the command below.
conda install -c conda-forge camelot-py
Attaching the logs when I try to import camelot for pdf parsing and text extraction purposes.
Traceback (most recent call last):
File "/~/PycharmProjects/Utilities/rosblancos/pdf-utilities/pdf-element-extractor.py", line 1, in <module>
import camelot
File "/~/.conda/envs/Utilities/lib/python3.7/site-packages/camelot/__init__.py", line 6, in <module>
from .io import read_pdf
File "/~/.conda/envs/Utilities/lib/python3.7/site-packages/camelot/io.py", line 5, in <module>
from .handlers import PDFHandler
File "/~/.conda/envs/Utilities/lib/python3.7/site-packages/camelot/handlers.py", line 9, in <module>
from .parsers import Stream, Lattice
File "/~/.conda/envs/Utilities/lib/python3.7/site-packages/camelot/parsers/__init__.py", line 4, in <module>
from .lattice import Lattice
File "/~/.conda/envs/Utilities/lib/python3.7/site-packages/camelot/parsers/lattice.py", line 27, in <module>
from ..image_processing import (
File "/~/.conda/envs/Utilities/lib/python3.7/site-packages/camelot/image_processing.py", line 5, in <module>
import cv2
ImportError: dlopen(/~/.conda/envs/Utilities/lib/python3.7/site-packages/cv2.cpython-37m-darwin.so, 2): Library not loaded: #rpath/libglib-2.0.0.dylib
Referenced from: /~/.conda/envs/Utilities/lib/libharfbuzz.0.dylib
Reason: Incompatible library version: libharfbuzz.0.dylib requires version 5601.0.0 or later, but libglib-2.0.0.dylib provides version 0.0.0
Process finished with exit code 1
I googled the error above and found this issue. However, I am unable to solve this issue as I am not able to find out what I need to do with the file named libglib.
Doing this worked for me:
pip install opencv-python
I have the Anaconda distribution of Python 2.7 and I needed to install the Jupyter notebook package. During the installation process my computer turned off and after that I couldn't continue with the process. I tried to uninstall Jupyter and try installing it again, but I keep getting the same error:
Traceback (most recent call last):
File "C:\Users\Acer\Anaconda\Scripts\ipython-script.py", line 3, in <module>
from IPython import start_ipython
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
from IPython.terminal.ipapp import load_default_config
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 22, in <module>
from IPython.core.completer import IPCompleter
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\core\completer.py", line 71, in <module>
from IPython.utils import generics
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\utils\generics.py", line 8, in <module>
from simplegeneric import generic
ImportError: No module named simplegeneric
What should I remove/add in order to make it work?
You need to install the python package simplegeneric. After you install it, you need to install the next package that you fail to import. Continue this process until you dont get any import errors.