I am using anaconda on mac-osx and have installed python-igraph. Currently not being able to import igraph.
Below is the error shown:
Python 2.7.12 |Anaconda 4.1.1 (x86_64)|
import igraph ----
ImportError: No module named igraph
It is present in this path - /Users/pc_name/anaconda/lib/python2.7/site-packages and I find only python_igraph-0.7.1.post6-py2.7.egg-info file.
I tried many things possible which are available on the other questions here at stack overflow. How can I solve this problem?
I used the following command and it worked for me in Python 3.7
pip install python-igraph
The detail about the package and its installation can be found
https://igraph.org/python/
You haven't mentioned how you installed python-igraph so it's hard to say anything. But I'm pretty sure that this package works nicely.
1)While in the python-igraph-master directory on my computer run the following:
conda install -c marufr python-igraph
2)In a new terminal window kick start python:
$python
Python 2.7.13 |Anaconda 4.3.1 (x86_64)| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import igraph
>>>
I hope this helps
Related
In my RaspberryPI ZERO W I got strange error when trying to import altair module in python script.
pi#raspberrypi:~ $ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import altair
Illegal instruction
pi#raspberrypi:~ $ pip3 freeze
altair==4.2.0
Does anybody have an idea if there is a version, which works on RaspberryPi? Or any other idea why it is happening?
Illegal Instruction means that you are importing a C extension that is compiled incorrectly for the system you are using. Altair itself doesn't have any C extensions, but it depends on a number of libraries that do include C extensions, which you can see in its requirements.txt file:
entrypoints
jinja2
jsonschema>=3.0
numpy
pandas>=0.18
toolz
I would suggest trying to import each of these libraries to narrow-down which package is incorrectly installed, and then search for information on how to correctly install the problematic package on RaspberryPi ZERO.
I am trying to import a python module in R using the reticulate package. The module can be found here. I cloned the repository and ran python setup.py install which ran successfully. If I open a python shell, I'm able to import debot. However, when I try to import it in RStudio, I get the following error:
dbot=import("debot")
Error in py_module_import(module, convert = convert) :
ImportError: No module named debot
I am on macOS Sierra version 10.12.6 and installed python 3.6 through Anaconda. I have also tried giving the path to python as:
path_to_python <- "/anaconda/bin/python3.6"
use_python(path_to_python)
When I run python from a terminal, I get:
Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Not sure if the path to python is correct.
Ok, did some more digging around and discovered that reticulate still refers to my older python path for python 2.7 which came as default with my Macbook. When I run py_config(), this is what I get:
python: /usr/bin/python
libpython: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
pythonhome: /System/Library/Frameworks/Python.framework/Versions/2.7:/System/Library/Frameworks/Python.framework/Versions/2.7
version: 2.7.10 (default, Feb 7 2017, 00:08:15) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]
No matter what I try but I can't get reticulate to look at the correct path where the module has been installed using the use_python() function. I do believe this is an issue with reticulate. Any ideas what my next steps should be?
After reading this I finally figured out. I think before calling any other function from the reticulate package, it is imperative to specify the path to python to use. Hence the order I am following now is:
library(reticulate)
path_to_python <- "/anaconda/bin/python"
use_python(path_to_python)
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cvxopt import matrix
>>> 2 * matrix(1.0, (1, 4))
Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so
When running the above scripts I get an Intel MKL Fatal Error. The test that is mentioned in issues with similar error passed. The test is
python -c 'import sklearn.linear_model.tests.test_randomized_l1'
I ran python with LD_DEBUG=symbols and see the below error in the logs
/opt/anaconda3/lib/python3.5/site-packages/cvxopt/../../../libmkl_avx.so: error: symbol lookup error: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8 (fatal)
Does anyone know how to fix this? I am interested in retaining the mkl option and not the nomkl one
NOTE mkl is installed and at newest version and so is scikit-learn
I ran into this while running the examples on http://scikit-learn.org/stable/modules/linear_model.html. Apparently a bunch of libraries are not being loaded automatically. Here are the manual loads I'm using so far, others will probably be needed depending on what you are doing. For me it did fix the one test case in the question.
CONDA_LIB=$CONDA_PREFIX/../../lib
LIBS=$CONDA_LIB/libmkl_intel_thread.so:$CONDA_LIB/libmkl_avx.so:$CONDA_LIB/libmkl_core.so:$CONDA_LIB/libiomp5.so:/lib/libgomp.so
LD_PRELOAD=$LIBS python
The mkl package is probably missing in your anaconda installation.
a) You could try to upgrade anaconda completely:
conda upgrade anaconda
b) Alternatively you could explicitly install mkl:
conda install mkl
I have not checked a), but used b). In this case you might need to upgrade also sklearn module:
conda upgrade scikit-learn
I've tried many ways to install scipy but without successes. I use virtualenv on Linux Mate.
After the workon command I tried
pip install scipy
or
easy_install scipy
end every time is a "failed with exit status 1"
I tried also
apt-get install python-scipy
and I've no errors but if I run python
python
import scipy
I'll have "ImportError: No module named scipy"
What is wrong?
I'd suggest using Miniconda to install scipy.
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh
bash Miniconda-latest-Linux-x86_64.sh -b
Then, create a Conda environment with scipy installed:
conda create -n scipy scipy
Now you'll have access to the activate and deactivate scripts, used to open and close Conda environments.
$ source activate scipy
discarding /Users/username/miniconda/bin from PATH
prepending /Users/username/miniconda/envs/scipy/bin to PATH
(scipy)$ python
Python 2.7.11 |Continuum Analytics, Inc.| (default, Dec 6 2015, 18:57:58)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import scipy
>>> scipy.version.version
'0.16.0'
[Edit] You indicated you want to use the system installed scipy package, that you have successfully installed via apt, in a virtualenv. You can instruct virtualenv to create a new environment that includes all the system Python packages like this:
$ virtualenv --system-site-packages scipy_env
New python executable in scipy_env/bin/python
Installing setuptools, pip...done.
$ source scipy_env/bin/activate
(scipy_env)$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
I have a package called 'Prody' which is installed under anaconda directories:
$ python
Python 2.7.8 |Anaconda 2.0.1 (x86_64)| (default, Jul 2 2014, 15:36:00)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import prody
>>> prody.__file__
'//anaconda/lib/python2.7/site-packages/ProDy-1.5.1-py2.7-macosx-10.5-x86_64.egg/prody/__init__.pyc'
I'd like to remove that file with this command but failed:
$ conda remove prody
Error: no packages found to remove from environment: //anaconda
What's the right way to do it?
You can remove packages installed with pip using pip uninstall.
Did you install Prody via pip? Then I don't think that conda remove can remove it. AFAIK, conda manages only conda packages.