Problems detecting PythonMagick after install Mac OSX - python

I followed the instructions at https://gist.github.com/2778301 but when I try to do import PythonMagick I get the error message:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "PythonMagick/__init__.py", line 1, in <module>
from . import _PythonMagick
ImportError: cannot import name _PythonMagick
The PythonMagick.so is in my python2.7 site-packages.
EDIT:
I solved this problem by copying from where make install installed PythonMagick /usr/local/lib/python2.7/site-packages/PythonMagick to where Python actually looks on a OS X Lion, /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

There's an answer to your question on the link you provided:
This can be fixed by changing the first line of __init__.py in PythonMagick, which is usually found in the site-packages directory, for instance,
python2.7/site-packages/PythonMagick
Try changing:
from . import _PythonMagick
to
import _PythonMagick

Related

ImportError: No module named gobject

I installed ros1 and created a catkin workspace. Inside the src folder I cloned a ros package "executive_smach_visualization". But when I try to run it with the following command I am getting an error.
rosrun smach_viewer smach_viewer.py
Traceback:
wxversion 2.8 is not installed, installed versions are ['3.0-gtk3']
Traceback (most recent call last):
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 77, in <module>
from smach_viewer import xdot
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/__init__.py", line 1, in <module>
import wxxdot
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/wxxdot.py", line 22, in <module>
from xdot import *
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/xdot.py", line 34, in <module>
import gobject
ImportError: No module named gobject
I have already tried following:
1) Installed goobject using pip
2) cloned gobject from git to src folder of catkin_ws, catkin_make and setup.bash
What could be the problem? Please let me know if I am missing any important input. Thanks in advance.
This issue occurs if there is different version of ros, python and so on.
It seems package is a little bit outdated.
Edit:
After downloading package and when building your working environment, use:
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so
Please refer to 1.5 section (User configuration) of this guide

Why i got that problems when i run my script?

Hi, is there a solution for this error code ?
Traceback (most recent call last):
File "./weevely.py", line 2, in <module>
from core.terminal import Terminal
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/terminal.py", line 6, in <module>
from core.module import Status
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/module.py", line 14, in <module>
from core.vectorlist import VectorList
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/vectorlist.py", line 15, in <module>
from core.vectors import Os
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/vectors.py", line 11, in <module>
from mako.template import Template
ImportError: No module named mako.template
Thanks.
The answer is pretty self explainatory and with a google search you could have solved everything in seconds.
Here you have a how to install pip if you don`t have it: How do I install pip on macOS or OS X?
After this type in the terminal:
pip install Mako
as stated in the official website: http://www.makotemplates.org/download.html
If this doesn`t work you can manually download the Mako package here:
https://pypi.python.org/pypi/Mako/
Please, also read this carefully:
https://stackoverflow.com/help/how-to-ask

Unable to import cv2

I tested the following command in python:
import cv2
I put it in the file b.py and run python b.py. But I met with the following error:
Traceback (most recent call last):
File "b.py", line 1, in <module>
import cv2
File "/home/mypath/anaconda2/lib/python2.7/site-packages/cv2/__init__.py", line 9, in <module>
from .cv2 import *
ImportError: libXdmcp.so.6: cannot open shared object file: No such file or directory
What's wrong with this? Thank you all for helping me!
Did you install opencv correctly? Also what OS are you using (e.g. Windows, Linux OS X etc.)
If you're using windows - did you follow these steps?:
http://docs.opencv.org/3.2.0/d5/de5/tutorial_py_setup_in_windows.html
If you are using Fedora install Opencv by typing this command into the terminal:
sudo yum install numpy opencv*
The cause of the problem may be that you haven't installed the dependencies:
Matplotlib
Numpy
Hope this helps!

Can't find submodule in package

I'm using Anaconda3 version 4.2.0 on ubuntu (in docker).
Anaconda is installed in /root/anaconda3 folder.
I installed theano_bpr package using pip install theano_bpr.
Now when i open python and try import theano_bpr, i get the following message:
>>> import theano_bpr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/lib/python3.5/site-packages/theano_bpr/__init__.py", line 17, in <module>
from bpr import BPR
ImportError: No module named 'bpr'
However, when i navigate to /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ and run python there, i'm able to import theano_bpr.
In /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ there are following files:
__init__.py, bpr.py (this one is causing problems), t.py, and utils.py.

Python igraph import error on Windows

I've installed igraph form .whl file using pip install. When I was trying to test the correctness of installation
import igraph.test
igraph.test.test()
I got this error:
Traceback (most recent call last):
File "D:/Nauka/Praca-inzynierska/Barabasi-Albert.py", line 4, in <module>
import igraph.test
File "D:\Programy\Python 3.5\lib\site-packages\igraph\__init__.py", line 34, in <module>
from igraph._igraph import *
ImportError: No module named 'igraph._igraph'
(the same error pops out if I'm trying to import igraph not igraph.test).
I've tried adding path (I don't know if this is rigth):
import sys
sys.path.append ("D:/Programy/Python 3.5/Lib/site-packages/igraph")
but it didn't work.
One thing I discovered is that if I delete "__init__" file from igraph folder I can import igraph without error, but it doesn't work for igraph.test.
If it's relevant I have Python 2.7 installed on my machine alongside Python 3.5.
Thank you in advance for any help.

Categories

Resources