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.
Related
My Pillow installation is broken system-wide.
Either using my OS X pillow version, or other 'isolated' installations within anaconda environments, I always get the same error, while trying to process images:
AccessInit: hash collision: 22 for both 1 and 1
It used to work in the envs, but after some urllib installs it broke in the environments also.
I have tried, at the top of my script (to no avail):
import PIL.Image
sys.modules['Image'] = PIL.Image
from PIL import Image
I have already uninstalled an reinstalled Pillow, again to no avail.
my Python:
Python 2.7.14 |Anaconda, Inc.| (default, Oct 5 2017, 02:28:52)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
How can I make it work again?
Your problem is likely that two different Python modules are being imported with the same name - https://web.archive.org/web/20110121072135/https://jaredforsyth.com/blog/2010/apr/28/accessinit-hash-collision-3-both-1-and-1/
Without having access to your installation, it is hard to figure out exactly what is happening, so I would suggest tracking each import. A good start would be to see what is imported.
import sys
sys.modules
That, combined with going into the site-packages directory of your Python install and manually removing packages until you find the problematic package, will hopefully give you a good start.
I'm trying to simply install and use cv2, numpy and matplotlib.
All installed successfully but when I type into the terminal "import ..." it gives me the following error?
I'm confused because what the terminal is suggesting, I've already installed it that way?
I'm not sure about why it's pointing me to the packages either?
import cv2
The program 'import' can be found in the following packages:
* imagemagick
* graphicsmagick-imagemagick-compat
Try: sudo apt-get install <selected package>
Thanks
import is a command from imagemagick and graphicsmagick, you are trying to import a module python in you terminal, but, you should import in python shell:
$ python
Python 3.6.3 (default, Oct 9 2017, 12:11:29)
[GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> code_here
>>> exit()
OVERVIEW from import from imagemagick.
The `import` program is a member of the ImageMagick(1) suite of tools. Use it to capture some or all of an X server screen and save the image to a
file.
For more information about the import command, point your browser to file:///usr/share/doc/ImageMagick-6/www/import.html or http://www.imagemagā
ick.org/script/import.php.
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)
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
The documentation of the Python readline module says "Availability: Unix". However, it doesn't appear to be available on OS X, although other modules marked as Unix are available. Here is what I'm using:
$ uname -a
Darwin greg.local 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
$ which python
/usr/bin/python
$ python
Python 2.3.5 (#1, Nov 26 2007, 09:16:55)
[GCC 4.0.1 (Apple Computer, Inc. build 5363) (+4864187)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named readline
>>>
I have also installed Python 2.5 through MacPorts but readline is not available there either.
What can I do to provide readline functionality for Python's raw_input() function on OS X?
Have you tried to install the py-readline (or py25-readline for Python 2.5) port?
Also, in the snippet above, you are NOT using the MacPort python, but rather the Apple Python.
The MacPort version should be located in the /opt/local directory structure. You should check your path.
Try rlwrap. It should work with any version of python and in general any shell.
Install via brew install rlwrap on Mac OS X
usage as rlwrap python. It stores history as well.
It's not shipped in OS X because of licensing issues (restrictions brought to you by the GPL).
Macports python should be fine if you have the readline package installed.
You should be able to get readline support on Mac's native Python. Apparently it's implemented via BSD's editline, and you have to start it up slightly differently. I just tested this on a Mac, and it works fine (OS X 10.5.7). See man python for more details, the section "Interactive Input Editing and History Substitution" - mirrored on the web here.
luga ~ $ python
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rlcompleter
>>> import readline
>>>