Unusual error while installing any pip based package - python

I do not remember since when, but whenever I install any pip based package, my system (Ubuntu 14.04, Python 2.7.6) trows a warning/error :
Url 'file:///home/username/.pip-wheelhouse' is ignored: it is neither a file nor a directory.
I don't know where this line came from but the pip package I'm installing installs very well, but this line is always shown. How can I remove this ?

There are a few things that can cause this. First take a look at your pip configuration file at ~/.pip/pip.conf and see if it contains a section like this:
[wheel]
wheel-dir = /home/username/.pip-wheelhouse
If so, comment that section out, use pip, and see if that gets rid of the message.
This config file specifies the same information as some environment variables. Try this:
env | grep -i wheel
This command will list all of your environment variables that contain the word wheel. If you see any output, look for a line that specifies the .pip-wheelhouse directory. For example, PIP_FIND_LINKS is the top suspect. When you've found the culprit and you just need to track down where those variables are getting set. The top candidate files for setting variables like that would be ~/.bashrc, ~/.profile, and /etc/profile. Search those files for the word wheel and I suspect you'll be able to resolve this.

Related

How to compare requirement file and actually installed Python modules?

Given requirements.txt and a virtualenv environment, what is the best way to check from a script whether requirements are met and possibly provide details in case of mismatch?
Pip changes it's internal API with major releases, so I seen advices not to use it's parse_requirements method.
There is a way of pkg_resources.require(dependencies), but then how to parse requirements file with all it's fanciness, like github links, etc.?
This should be something pretty simple, but can't find any pointers.
UPDATE: programmatic solution is needed.
You can save your virtualenv's current installed packages with pip freeze to a file, say current.txt
pip freeze > current.txt
Then you can compare this to requirements.txt with difflib using a script like this:
import difflib
req = open('requirements.txt')
current = open('current.txt')
diff = difflib.ndiff(req.readlines(), current.readlines())
delta = ''.join([x for x in diff if x.startswith('-')])
print(delta)
This should display only the packages that are in 'requirements.txt' that aren't in 'current.txt'.
Got tired of the discrepancies between requirements.txt and the actually installed packages (e.g. when deploying to Heroku, I'd often get ModuleNotFoundError for forgetting to add a module to requirements.)
This helps:
Use compare-requirements (GitHub)
(you'll need to pip install pipdeptree to use it.)
It's then as simple as...
cmpreqs --pipdeptree
...to show you (in "Input 2") which modules are installed, but missing from requirements.txt.
You can then examine the list and see which ones should in fact be added to requirements.txt.

Python PIP using .cfg

I have a package I am installing in Python that requires dependancies or it fails to install:
> pip install http://etc
pak/test.cpp:3:10: fatal error:
'tools/test.cv' file not found
#include "tools/test.cv"
I have been infomred that I need to download the files (which I have done) then...
create a file ~/.tools.cfg containing:
[build_ext]
include_dirs=/path/to/home/tools
However, I don't understand this last part!
How does the pip installer pick up the .tools.cfg file, where do I even create the file .tools.cfg?
I'm running this on a mac if thats makes a difference.
According to the path you gave, you make the file in your home directory. On a Mac (OS X, I assume), that is a sub-directory of /Users named for your user name (i.e. /Users/Sputnik). You can create it with any text editor, i.e. emacs, vim, nano, TextEdit.app, etc.
I don't know exactly how the pip installer is looking up that file, but presumably it's looking for a file with the name of the package (in this case, tools).
Please comment if this doesn't answer your question, and accept (i.e. click on the Checkmark) if it does!

How to install apscheduler

I would like to use scheduler in my python program however I haven't been able to install it.
I tried with Easy_Install and PIP (neither of which I've used before) and I can't find a link for another method. I'm using Python 2.7 on Windows Vista
Since I've never used PIP before I had to install that first. After installing pip I went to command prompt, changed to the directory with pip and typed:
C:\Python27\Scripts>pip install apscheduler
It didn't come up with an error so I assumed it installed, however when I run my python program, which includes the line: from apscheduler.scheduler import Scheduler
it states:
ImportError: No module named apscheduler.scheduler
and when I look at the list of installed modules in Idle it's not there.
It's probably something obvious since I don't have a lot of experience in programming yet.
Help would be much appreciated!
sm
Hi again,
I got it working finally, in the end I didn't use PIP, in case other people need help this is what I did:
Downloaded the apscheduler tar.gz file
Downloaded 7-zip, since this can extract tar.gz files on Windows.
Extracted the tar.gz file using 7-zip, I had to do this twice since the first time I clicked extract it extracted to a .tar file (APScheduler-2.1.2.tar), it was necessary to extract this file as well.
Added C:python27\ to the windows path (this is in control panel->system & maintenance->system->advanced system settings->environment variables)
(I also added C:python27\scripts\ to the path, but not sure whether this makes a difference.
Opened command prompt and moved to the folder containing the extracted APScheduler files including the file named setup.py
In my case this was- C:\Python27\APScheduler\APScheduler-2.1.2\APScheduler-2.1.2\
In command prompt typed> python setup.py install
Hopefully this was everything, perhaps one day I'll delete everything and try again to check, but it took quite sometime to get it going so right now I think I'll leave it as is.

compiler error when installing mysql-python on os x lion in a virtualenv

I've found 101 threads on this but no solutions for my actual problem.
Here's the situation. virtualenv, installed yolk, checked out my code into that env, the code includes django so don't have to install it into the env.
I've added the project location into the activate script.
The next step is to install mysql-python but that will fail. However the source is downloaded so I can edit setup_posix.py put the mysql_config location in and then retry.
So the command is
pip install mysql-python -E focus02
with focus02 being the env name.
The error message is this
lipo: can't open input file: /var/folders/38/bjgqwdxn37lb1ytw3qtmrwxc0000gp/T//ccTgPn2I.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1
most of the stuff I've found online focuses on the last line of that, stating the compiler doesn't exist. I can prove this isn't the case by running llvm-gcc-4.2 in terminal. I get a response of
i686-apple-darwin11-llvm-gcc-4.2: no input files
I think the error is in the line above. Note the double slash before the file name. I can't find an article on google that shows that someone has found a fix. Anyone know where that line is drawing its input from, as I'm not sure where the issue is coming from. I'm assuming I've edited a file and left a trailing slash that I didn't need, though there's a few instances of this error that leads me to believe maybe not.
I've found this article and it's not fixed the problem.
just in case google brings anyone to this page in search of an answer i managed to solve this one this morning.
the fix is to link the right mysq_config in when trying to install mysql-python
so line 24 of setup_posix.py is the line that fails the install process as you intall python-mysql the first time. you need to fixup the line then rerun the pip install command.
line 24 is the link to mysql_config. when you're running MAMP the binaries for mysql_config won't work for this, so make sure you've downloaded the mysql source elsewhere, stored it on your path or added the folder to your path and then link it in correctly inside the setup_posix.py file before installing mysql-python.
hope this helps someone.

Problem using easy_install.exe to install pyMySQL for Django

I'm trying to install the pyMySQL module for python so that I can setup Django (see this previous question).
I can't get easy_install.exe PyMySQL-0.3-py2.6.egg to run for the life of me. Every time I get the error easy_install.exe not recognized as an internal or external command... I've tried adding various directories to my system path including:
C:\Python27\Lib\site-packages\;
C:\Python27\Scripts\;
C:\Python27\Scripts\easy_install.exe
C:\Python27\Scripts\easy_install.exe PyMySQL-0.3-py2.6.egg
What am I missing that is keeping this from executing?(note I'm on windows 7)
You have to install setuptools first
[edit]
Uh,
C:\Users\Robus>easy_install
Yada yada, not found
C:\Python26\Scripts>easy_install
error: No urls, filenames, or requirements specified (see --help)
C:\Python26>
The next best thing I can think of is - do you, by any chance, have more than one version of python installed? In that case setuptools might have been installed somewhere else

Categories