I created a virtualbox with a fresh install of ubuntu 9.10.
I am trying to get MySQLdb to run on python but I'm failing at the import MySQLdb
I first tried sudo easy_install MySQL_python-1.2.3c1-py2.6-linux-i686.egg and then sudo apt-get install python-mysqldb.
Both apparently installed ok, but gave me the following error message when in python I have the import line:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/MySQLdb/__init__.py", line 19, in <module>
File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 7, in <module>
File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 6, in __bootstrap__
ImportError: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory
I have already installed MySQL and it is running, if that matters at all.
I tried following this, but failed in step 2
Your MySQLdb egg installation looks like it is not working properly. You should go into /usr/local/lib/python2.6/dist-packages and remove it.
The Ubuntu python-mysqldb package should work fine. Unless you have a good reason, you should stick to your distribution's package manager when installing new software.
Related
I have installed wxPython on my RPi using
sudo pip3 install wxPython-4.0.7.post2-cp37-cp37m-linux_armv7l.whl
But when I attempt to run my python program (which works on my windows machine), I get
Traceback (most recent call last):
File "TrainingUI.py", line 2, in <module>
import wx.media
File "/usr/local/lib/python3.7/dist-packages/wx/media.py", line 13, in <module>
from ._media import *
ImportError: libgstreamer-0.10.so.0: cannot open shared object file: No such file or directory
I see that the media.py file has the from ._media import * line in it, but I don't know what it means. I used ls -a to see that there is no file named ._media, and I'm not experienced enough with python to know what else it might refer to.
How can I get this wx distribution to work with my python3.7 on the RPi?
We (eventually) found:
sudo apt-get install libgstreamer-plugins-base0.10-0
and the error when wx.media is imported is now gone. We can't get MediaCtrl to work, but that's for another post...
I can't run pip2, which is installed from its Arch Linux package:
$ pip2
Traceback (most recent call last):
File "/usr/bin/pip2", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 47, in <module>
from pkg_resources.extern.six.moves import urllib, map, filter
ImportError: No module named moves
I reinstalled python2-pip2 and python2-setuptools with no results. This has been a problem for months.
While I don't understand the issue, it is possible to reset it by removing locally (--user) installed packages:
Move all packages installed as the user:
mv ~/.local/lib/python2.7/site-packages ~/site-packages-bak
or try to pinpoint the problematic files. In my case, for some reason I had a python file and its pyc file lying around the site-packages directory and just moving them solved my issue:
mv ~/.local/lib/python2.7/site-packages/six.py ~/six.py-bak
mv ~/.local/lib/python2.7/site-packages/six.pyc ~/six.pyc-bak
I'm trying to use the virtualenvwrapper to make a python 3 based virtualenv. However,I'm when I pass the optional interpreter argument, I'm seeing this error. I'm running Ubuntu 15.04. I tried reinstalling virtualenv and virtualenvwrapper without success. Thanks for all your help!
$ mkvirtualenv scriptcutter --python=/usr/bin/python3
Running virtualenv with interpreter /usr/bin/python3
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 8, in <module>
import base64
File "/usr/lib/python3.4/base64.py", line 9, in <module>
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Original exception was:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 8, in <module>
import base64
File "/usr/lib/python3.4/base64.py", line 9, in <module>
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
I come across same issue, but after I downgrade virtualenv to 12.0.2, this problem disappears.
This is sort of a workaround for now.
Create a virtualenv using pyvenv.
# install pyvenv on Ubuntu
sudo apt-get install python3-venv
To minimize disruption in your normal workflow, pass a destination directory that is the same as the one used by virtualenvwrapper Like so,
pyvenv example ~/.virtualenvs/example
This is automatically working with workon and cdproject commands. I don't use much else that is provided by virtualenvwrapper
Hope this helps.
You can upgrade to the most recent version of virtualenv, with:
sudo pip install --upgrade https://github.com/pypa/virtualenv/archive/master.zip
virtualenv --version
# Returns 15.2.0.dev0 when I ran it
The following command then works:
mkvirtualenv scriptcutter --python=/usr/bin/python3
Apparently, the develop branch was dropped, so the URL with "develop" will no longer work. My answer was based off of #pjotr_dolphin's comment, with the URL updated.
I am running EPD python 2.7.3. I have installed psycopg2 by easy_install . But When i try to import the psycopg2, It shows the following error:
>>>import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
Referenced from: /Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/psycopg2/_psycopg.so
Expected in: dynamic lookup
I am runnin mac osx Mountain lion. Any suggestion?
it should work, i installed with $ sudo apt-get command on Ubuntu. everything work fine. may try to uninstall the postgresql and reinstall it.
hope somebody helps me to install wxPython.
I have ubuntu 11.10 and there is no build package for it.
I used this page ( http://wxpython.org/BUILD.html ) as guidance to install
after installing, I run
>python
>>>import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "wx/__init__.py", line 45, in <module>
from wx._core import *
File "wx/_core.py", line 4, in <module>
import _core_
ImportError: libwx_gtk2u_adv-2.9.so.3: cannot open shared object file: No such file or directory
What should do to fix it?
thank you!
Follow the instructions for installing on Ubuntu or Debian.
EDIT: Actually, you don't even need to do that, since it's in the main repos:
sudo aptitude install python-wxgtk2.8