I'm trying to install pyev on Ubuntu using pip but I get this error. libev.so.4 does indeed exist, I found it at /usr/local/lib along with other libev.so files so I assume it's simply a matter of python isn't looking in the right spot or the .so's got put in the wrong place by mistake.
$ pip install pyev
Collecting pyev
Using cached pyev-0.9.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-cBE9pk/pyev/setup.py", line 57, in <module>
check_version(libev_version(), min_libev_version, "libev")
File "/tmp/pip-build-cBE9pk/pyev/setup.py", line 48, in libev_version
libev_dll = cdll.LoadLibrary(libev_dll_name)
File "/usr/local/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "/usr/local/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libev.so.4: cannot open shared object file: No such file or directory
So my question is where the libev.so files should live, or, if they're in the correct place, why can't python find them and how do I fix it?
EDIT: Python version 2.7.10, Pip version 7.1.0 both downloaded and installed today (Python manually, pip using get-pip.py)
locate libev gives me a long list of files for libevent, libevolution, and libevview. Pretty much the only thing related to libev was usr/lib/libevdocument.so.1, usr/lib/libevdocument.so.1.0.0, and /usr/share/doc/libevdocument1 (which included AUTHORS, NEWS.gz, README, TODO, changelog.Debian.gz, and copyright). Nothing in local for some reason
EDIT 2.0
Running it as sudo (can't believe I forgot that) gives me a weird error message "The directory /home/username/.cache/pip/http or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag." and then proceeded to redownload pyev-0.9.0.tar.gz and run into the same error of not finding libev.so.4.
Running it as 'sudo -H pip install pyev' gave me the first error message again (using the cached pyev). What does sudo -H do anyway? I couldn't find anything about it online or in the sudo help message.
Looking at another partition that has libev properly installed I was able to find the libev.so files under usr/lib rather than usr/local/lib. Copying them to that folder and running sudo -H pip install pyev seems to have properly installed pyev. Thanks for your help.
Related
Trying to use the google api client, I have gotten an error that MANY others have gotten:
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlencode'
I have tried every solution found in StackOverflow, GitHub, and other places, including:
1) from this thread, changing the path in the actual code:
import sys
sys.path.insert(1, '/Library/Python/2.7/site-packages')
2) from this thread, changing the python path in the .bashrc and .bash_profile files:
pip show six | grep "Location:" | cut -d " " -f2
export PYTHONPATH=$PYTHONPATH:<pip_install_path>
source ~/.bashrc
3) and from this thread, downgrading my google api client to 1.3.2 (or at least trying to).
I'm new to programming so this could be a basic problem but I've spent days trying to troubleshoot and to no avail. It seems like no matter what I do, the old 1.4 version of six is being used. Any help you could provide would be MUCH appreciated!
EDIT: Full Traceback:
Traceback (most recent call last):
File "/Users/zachgoldfine/PycharmProjects/FirstTry/GetAroundRentalSpreadsheetRead.py", line 71, in <module>
spreadsheetId=spreadsheetId, range=rangeName1).execute()
File "/Library/Python/2.7/site-packages/oauth2client/util.py", line 129, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Library/Python/2.7/site-packages/googleapiclient/http.py", line 836, in execute
method=str(self.method), body=self.body, headers=self.headers)
File "/Library/Python/2.7/site-packages/googleapiclient/http.py", line 162, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "/Library/Python/2.7/site-packages/oauth2client/transport.py", line 186, in new_request
credentials._refresh(orig_request_method)
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 761, in _refresh
self._do_refresh_request(http)
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 774, in _do_refresh_request
body = self._generate_refresh_request_body()
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 716, in _generate_refresh_request_body
body = urllib.parse.urlencode({
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlencode'
Assuming it's indeed a problem with the six version, here is one way to install six and be able to use the newly installed version.
Important note: this will only work from your user account; not from any other account.
On the safe side: this will not alter the system Python environment, that is, system scripts that may use Python will continue to use the older pip version.
Firstly, reverse the three steps above. In particular, manually altering sys.path in a script should really very rarely be necessary.
Then, use the --user option, which installs a local version, that Python (when run by that user) will automatically pick up first.
To make sure the Python executable you are using corresponds to the pip module and (later) the installed six module, use the following:
python -m pip install six --user
where python may be something slightly else, if you happen to not use the system Python (e.g., z/usr/local/bin/python, orpython3, etc).
There is no need forsudo` or similar.
If pip complains that the requirement is already up to date (it shouldn't, or you wouldn't have gotten the above problems), try:
python -m pip install six --user --upgrade --force
Once done, you can check $HOME/Library/Python/x.y/lib/python/site-packages to see if you see the correct version of six there. This is your local user Library directory, not the system one. x.y is probably 2.7, but do check that python is actually that version.
The problem may also be with the google api client. I don't know if that has a pip installation, but otherwise you could try something similar as for six:
python -m pip install <google-api-client> --user (--upgrade --force)
I am facing these issues. Can you help me with the same ?
Why am I seeing this error ? Do I have to add anything in the requirements.txt file ?
>>> import git
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
import git
File "git\__init__.py", line 29, in <module>
_init_externals()
File "git\__init__.py", line 23, in _init_externals
raise ImportError("'gitdb' could not be found in your PYTHONPATH")
ImportError: 'gitdb' could not be found in your PYTHONPATH
>>> from git import Repo
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
from git import Repo
File "git\__init__.py", line 29, in <module>
_init_externals()
File "git\__init__.py", line 23, in _init_externals
raise ImportError("'gitdb' could not be found in your PYTHONPATH")
ImportError: 'gitdb' could not be found in your PYTHONPATH
I already had gitdb and smmap installed so I had to reinstall them.
You can reinstall them by running the following command in your terminal:
pip3 install --upgrade --force-reinstall gitdb; pip3 install --upgrade --force-reinstall smmap
I also got the message ImportError: 'gitdb' could not be found in your PYTHONPATH (when trying to use GitPython).BUT I had gitdb already installed!
Thanks to this hint I figured out that gitdb silently failed because it was missing smmap.
So I installed this and it worked.
You need to install gitdb package.
$ sudo easy_install gitdb
I had the same problem. However, gitdb and smmap were already installed by pip. As I used brew to install python and its dependencies on my mac, when I checked brew doctor command, it said that my /usr/local/sbin directory is not in my PATH. So I added it to my PATH (though it didn't have anything to do with the python) and everything worked out eventually.
MS Windows Versions of this problem can occur because of the order of Python versions in your system PATH, as it did for me. I did not realize that when I installed another program, it installed a newer version of Python for its own usage, and it appended my system PATH with the address to the newer version. I noticed it when I looked at the PATH variable and found two versions of Python being called. Windows uses the first it finds, and if the first doesn't match what your program expects, it gets confused and can't find the right path to the module. This is what I did to resolve it:
To check: an easy way to test if this is your problem is to see if the paths separated by semicolons are in the right order. That can be seen in the System Variables of Windows or by printing your PATH variable in your CMD shell like in this example:
C:> path
PATH=C:\Program Files (x86)\Python37-32\Scripts;C:\Program Files (x86)\Python37-32;C:\Program Files\Python38\Scripts;C:\WINDOWS
Temporary solution:
To see if it is going to fix your computer, change it in your CMD window. Your variable change will be discarded when the window is closed. One way to do this test is to copy the paths, move the Python references to the order they are needed, and write it back:
C:> set path = C:\WINDOWS;C:\Program Files (x86)\Python37-32;C:\Program Files\Python38\Scripts;C:\Program Files (x86)\Python37-32\Scripts\
Then run the Python program to see if this was your problem. Note that this is only an example; do not copy & paste it. Your path is customized for the programs on your computer.
Permanent solution: If the above test resolves your problem, you must change your System Variables to make the change permanent. For me that usually requires a reboot afterwards in order to make the variables appear in all new windows.
I am testing scrapy for the first time, and after installing it with the command:
sudo easy_install -U scrapy
everything seems to run ok. However, when I run:
scrapy startproject tutorial
I get the following:
luismacbookpro:~ luis$ scrapy startproject tutorial
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/Current/bin/scrapy", line 4, in <module>
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/pkg_resources.py", line 2711, in <module>
working_set.require(__requires__)
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/pkg_resources.py", line 690, in require
needed = self.resolve(parse_requirements(requirements))
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/pkg_resources.py", line 588, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: lxml
Any idea about what's going on? As you can tell, I am not proficient at all with OSX, and I am still trying to move from a windows "mentality" to OSX, so I don't know where to add paths, modify settings, dependencies, etc. Not even sure how to perform a clean uninstall and start all over.
Any feedback is appreciated, even your suggestions to use alternative python libraries that can perform the same functionality of scrapy. Thanks!
I think this will solve the error message you're seeing:
sudo easy_install --upgrade lxml
This problem can arise on Macs when you use pip to install some packages and easy_install to install others.
Let us know how you go :)
I'm trying to use MySQL with django and right now the following isn't executing properly:
python manage.py syncdb
I also downloaded the Mysql-python interpreter and ran the following lines but still an error:
python setup.py build
sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 49, in get_config
libs = mysql_config("libs")
File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: /usr/local/bin/mysql_config not found
I think it's having trouble finding mysql_config, is there a way that I can point the setup to the file? Right now my setup.py is in ~/Downloads and mysql is in /usr/local/mysql/bin
It seems you may not have any of the MySQL client applications installed. If you are using Linux (and this varies from distribution to distribution), the package you will need to install on Ubuntu is "mysql-client".
From the path you show, I'm guessing you are running on Mac OS X (you really need to state what platform you are using and what version of Python you are running). However, if you are on Mac OS X, your best bet by far is to use a complete solution of installing compatible versions of Python, MySQL client libraries, MySQLdb, and Django by using one of the third-party open source package managers on OS X: MacPorts, homebrew, Fink, or others.
See, for example, the answer here.
The answer was to edit the site.cfg file so that it points to the mysql_config file in the /usr/local/mysql dir
Got this django project that I assume would run on virtualenv. I installed virtualenv through pip install and created the env but when I try to feed the pip requirements file, I got this:
Directory 'tagging' is not installable. File 'setup.py' not found.
Storing complete log in /Users/XXXX/.pip/pip.log
Here's the entry on the log file:
------------------------------------------------------------
/Users/XXXX/Sites/SampleProject/bin/pip run on Wed Jul 21 06:35:02 2010
Directory 'tagging' is not installable. File 'setup.py' not found.
Exception information:
Traceback (most recent call last):
File "/Users/XXXX/Sites/SampleProject/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/basecommand.py", line 120, in main
self.run(options, args)
File "/Users/XXXX/Sites/SampleProject/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/commands/install.py", line 158, in run
for req in parse_requirements(filename, finder=finder, options=options):
File "/Users/XXXX/Sites/SampleProject/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/req.py", line 1395, in parse_requirements
req = InstallRequirement.from_line(line, comes_from)
File "/Users/XXXX/Sites/SampleProject/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/req.py", line 87, in from_line
% name)
InstallationError: Directory 'tagging' is not installable. File 'setup.py' not found.
Also, here's the requirements file I'm trying to feed:
# to use:
# mkvirtualenv %PROJECT% (or workon %PROJECT%)
# export PIP_RESPECT_VIRTUALENV=true
# pip install -r requirements.txt
# you'll also need:
# mongodb1.1.4
# imagemagick > 6.3.8
# -e svn+http://code.djangoproject.com/svn/django/trunk#egg=djangoipython
ipdb
PIL
django-extensions
django-debug-toolbar
pytz
tagging
Could it be a problem with PIP? I have installed it through easy_install and used it already to install some modules such as fabric and etc. with no problems.
Hope someone could lend a hand :) BTW, here's my local setup: OSX 10.6.4, Python 2.6.1, Django 1.3 alpha. Thanks!
Sounds like you have a tagging/ directory in the directory from which you are running pip, and pip thinks this directory (rather than the django-tagging project on PyPI) is what you want it to install. But there's no setup.py in that directory, so pip doesn't know how to install it.
If the name of the project you wanted to install from PyPI were actually "tagging", you'd need to move or rename the tagging/ directory, or else run pip from a different directory. But it's not; it's actually django-tagging: http://pypi.python.org/pypi/django-tagging So if you just change the entry in your requirements file from "tagging" to "django-tagging," it should work.
All of this is a bug in pip, really: it should assume something is a PyPI project name rather than a local directory, unless the name you give has an actual slash in it or appended to it.
Is it possible you've copied the "tagging" directory from this location in the django-tagging source? In that case, you actually need the root from this location which has "tagging" as a sub-directory and a setup.py file. Just checkout from trunk or unzip to a "django-tagging" directory and make sure that your requirements file points to the "django-tagging" directory.