installed pip package not found - python

I was just given a new mac and after installing pip and lcc through pip I get a command not found error when running lcc run.
When running help("modules") inside of python I can see the lcc package there.
the same goes for pip freeze
pip freeze | grep lemon
lemoncheesecake==0.15.2
I'm running out of ideas.....
maybe I messed up the pip installation because I did it first with:
python get-pip.py
and then with
sudo easy_install pip
how do I fix this?
this is my echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Thanks

From what you're saying it seems that your python installation is not quite right, and Mac's version of python is also not quite right by default, you can read more about it here: http://docs.python-guide.org/en/latest/starting/install/osx/#doing-it-right
Also, I would highly advise that when you get a brand new Mac and plan to do some development work as a rule of thumb follow these steps:
Install xcode
Install Homebrew
Then you can install anything else you want.

I think the problem is due to the fact you have more than one version of python installed. Package installed by pip are visible to one version, but not to the other. I think this issue is quite common, and has already been answered (for example) here:
Too many different Python versions on my system and causing problems
To check that this is the case:
pip show Icc
should tell you where Icc was installed.
import sys
print sys.path
should tell where python looks for modules.

Related

Should Which Pip and Which Python Return the Same Directory? Zeppelin Configuration On Unix RHEL

This is probably a really dumb question but I am stuck and wasting too much time on this so I would SO appreciate any help.
I am using a RHEL 7 box and installed Apache Zeppelin on it. Everything works except for the life of me I can't import Python packages such as Pandas.
I realized I didn't have PIP so I installed it with these steps: https://pip.pypa.io/en/stable/installing/ (notice I had to use the "--user" argument for the command "python get-pip.py").
Finally, I did "pip install pandas --user" which worked perfectly. I then go into my Zeppelin notebook and I cannot import pandas, even after restarting the Python interpreter.
I did some research and I think the problem is that "which python" and "which pip" are installed in different directories as the former results in "/usr/bin/python" while the latter in "~/.local/bin/pip".
So I suspect the packages installed with pip are basically getting loaded into a different version of python? If it helps, when I do "whereis python" I get 5 different results such as "/usr/bin/python" and "/usr/bin/python2.7" etc.
First thing to understand is: Python packages aren't installed globally, every installed Python has its own set of packages. BTW, pip being a Python package with a script is also not global. If you have a few different pythons you need different pips for them. I don't know Apache Zeppelin so I cannot guess if it uses the system Python (/usr/bin/python) or has its own Python; in the latter case you need to install pip specifically for Zeppelin so its pip install packages available for Zeppelin.
To investigate to what Python pip installs packages you need to find out under what python it runs. Start with shebang:
head -1 `which pip`
The command will prints something like ~/.local/bin/python. If it's not the version of Python you need to install packages for you need to install a different pip using that Python.
The most complex case would be if the shebang is PATH-dependent, something like #!/usr/bin/env python. In that case pip runs Python that you can find with which python.
PS. AFAIK the simplest way to install pip at RedHat is dnf install python-pip.
phd's answer was very helpful but I found that it was just a matter of using the root account to install the python packages. Then my Zeppelin was able to see any packages.

multiple environment coremltools installation

Trying to install coremltools. I installed using pip but that is not the most recent version and I have run into a bug that was solved 4 days so I must build from source. I'm on a Mac virtual desktop(windows user) and I tried cmake, but since there are multiple pythons it keeps trying to install to python 3.7 when I need it to install for python 2.7.10. The github suggest doing this:
cmake . -DPYTHON=$(which python) -DPYTHON_CONFIG=$(which python-config)
.. however as someone who doesn't use cmake for package installs I'm unsure of the correct syntax could someone give me an example statement to go off of, I would really appreciate it. Thanks
You can install it without building it manually:
pip install https://github.com/apple/coremltools/archive/master.zip
You can replace "master" with any branch or tag names.
EDIT: To update an existing install add the -U flag. Or uninstall previous installations.

Cannot uninstall 'numpy'

I've been trying to install astropy and at the end of the installation I get this message:
Cannot uninstall 'numpy'. It is a distutils installed project and thus
we cannot accurately determine which files belong to it which would
lead to only a partial uninstall.
I have tried: pip uninstall numpy and then I get the same message.
I have Python 2.7.10 in a macOS High Sierra version 13.10.5
This doesn't directly answer your question, but that's because you're asking the wrong question.
Astropy requires Python 3.5 or 3.6. Trying to get it working with Apple's pre-installed Python 2.7 is a waste of time. You might be able to get an old version working this way, but not by using the installation instructions on astropy.org, and it won't be supported even if you do.
The easy solution is to just Install the latest Anaconda 5.x with Python 3.6, because it comes with Astropy built in.
The almost-as-easy solution is to install Python 3.6 from either a python.org binary installer, or Homebrew, and then use pip3 or, better, python3 -m pip to install everything, as explained on the Astropy install page.
Either way, before doing anything else, you want to get back to a clean slate. In particular, you do not want pip, or any other scripts, attached to Apple's Python 2.7; they will only cause confusion. Assuming you can't reinstall macOS from scratch, the best way to do this is:
Look in /Library/Python/2.7/site-packages and delete everything there except for README and Extras.pth.
Look in /usr/local/bin for symlinks to anything in that site-packages. (If you don't know much about using Unix, try this command: ls -l /usr/local/bin | grep 2.7.) You'll probably have pip and pip2.7 here, and probably nothing else. But whatever you have here, delete it.
Now, when you install Python 3.6, the only thing named pip anywhere will be that Python 3.6's pip. You still want to use pip3 or python3 -m pip, but if you screw up and type pip by accident, it won't break anything.
Also, you should strongly consider using a virtual environment. See the Python Packaging Authority's User Guide (or the Anaconda docs, if you went that way) for more on this.
One simple solution I found:
sudo -H pip install astropy --ignore-installed numpy
I also had this issue and couldn't get around it in a clean way, but this is what I did:
Inside the Lib folder search "numpy" for an egg_info file (eg. numpy-1.11.0.dev0_2329eae.egg-info).
In my case, this is what Pip was looking at to determine if a current version already exists. I deleted it, then ran normal
pip install numpy
and installed the newest version.
I don't recommend this because I don't understand what it's doing under the hood and it doesn't properly uninstall the old version which could be a recipe for trouble down the line, but if you're desperate like I was then maybe this is a solution for you.

Pip error: Fatal error in launcher: Unable to create process using '"'

I've seen many threads about this, and have tried all options except for completely wiping Python off of my machine and re-downloading everything...
I'm using a Windows 10, 64-bit machine, and had already downloaded Python2.7. Commands like 'C:\>pip install seaborn' were not an issue.
I recently downloaded Python3.6, and now my pip will not work - it returns the error in the title.
I have added C:\Python27, C:\Python36, C:\Python27\Scripts, C:\Python36\Scripts to my Path, and still it won't work.
If I type in the command C:\>python27 -m pip install seaborn, however, the pip works. I am really confused why I can no longer just type in pip install and have it work.
Thanks in advance!
You have two versions of Python added to path. To differentiate between 2.7 and 3.6 you have to tell it which version you want otherwise each pip conflicts with the other (it does not know what to install and where) in other words you type pip you could either mean for Python 2 or for Python 3.
Do not rename pip it will break your system (you should not need to rename). Instead use those already provided..
Your system should have these already:
pip is universal. Best for one installation.
pip3 for Python 3. Best to distinguish between Python 2 and 3
pip3.6 to distinguish between different Python 3 installations.
The same goes for Python 2 installation.
pip, pip2 and pip2.7.
You need to use either pip3 (or pip2) or pip3.6 (or pip2.7) to install in future. This will allow the different versions to be recognised:
For Python 2:
pip2 install seaborn
For Python 3:
pip3 install seaborn
You should also now use shebang lines as well now (if you are not already) to distinguish between versions.
the issue is the ambiguity between the two pip that you've mentioned in the Environments. As you mentioned the issue only started occurring when you installed python3 on the same system where python2 was installed and both have pip and hence when you fire up pip in your cmd, Windows System isn't able to pick one out of the two.
Why does your C:>python27 -m pip install seaborn work?
Well it's quite simple, since you've mentioned the python27 there, windows knows exactly which pip you're talking about.
How to fix it?
see the edits for this section. (I tried this, it didn't work) Removed it from the final answer to avoid confusion.
Alternatively, what you can do is,
rename your python.exe for python 3 to python3. Don't forget to put it inside your PATH environment. Just use python for python 2, python3 for python 3.
Their pip are separated, pip for python 2. pip3 for python 3.
Now, run and see the below commands behave:
# will return the default version of pip
pip --version
# will use the Python 2 version of pip
pip2 --version
# will use the Python 3 version of pip
pip3 --version
Okay so I finally worked it out...
I uninstalled Python3.6 and deleted all relevant folders.
I then went to Control Panel>Programs>Progams and Features and repaired my Python2.7 program. pip works now (I think it got messed up since I tried to rename the universal pip.exe file -> don't do that!!).
After re-downloading Python3.6, I put my universal pip.exe download from Python3 in a different directory so the Path would not get it confused. I now have Paths for both pip2 and pip3 and all is okay.
Thanks for your help!
This is how I solved this issue on my end: (short answer, remove this folder C:\Python27)
Problem: I installed python 3, after uninstalling python 2.7. The issue here is that pip remains behind even after you uninstall python 2.7.
Solution:
1. Uninstall python 3 (if you have it installed).
2. Just in case, I would uninstall python 2.7.
3. This is the key: go to C:\Python27 ... and delete the entire directory (which also contains pip).
This solution is good for those that are fine with ONLY running Python 3 on their machines (which was my case).

installing modules in python - pip, distribute, nose, virtualenv

I'm aware that there are similar questions on SO. This one, for example: What's the proper way to install pip, virtualenv, and distribute for Python?
I'd like to install these modules as per my Learn Python the Hard Way tutorial: http://learnpythonthehardway.org/book/ex46.html
I managed (I think) to install pip by using sudo easy_install pip but when I then ran pydoc modules I could not see it. So I'm not even sure it's installed.
The answer above in question 4324558 is difficult for me to understand: what's a bootstrap, what's curl and why would I set up a virtual environment? Yes, as a learner I should try to pick up as much as I can but I don't want to first create the universe, I just want to get the task at hand done.
How do I install these modules? Is it as complicated as it sounds in the quoted answer? The top voted answer says "Install virtualenv into a bootstrap virtual environment. Use the that virtual environment to create more. Since virtualenv ships with pip and distribute, you get everything from one install."
I really don't get what all that means. Isn't there something about the "Zen" of python and a one true way to get things done? Or am I out of context here? What is "the right way" to install these modules?
I tried:
pip install virtualenv in the terminal and received the following output:
Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Storing debug log for failure in /Users/myname/.pip/pip.log
I'm using a Mac and python 2.7
To solve your issue,
Just install (or upgrade) the setuptools:
sudo easy_install -U setuptools
Then you can run again: pip install virtualenv
Try adding 'sudo' in your command as-
sudo pip install virtualenv
It worked for me.
Have a look at Python Development Environment on Mac OS X Mavericks 10.9.
I followed these steps as well when trying to get Python 2.7 and Python 3.3 installed on OS X. It doesn't tell you how to install nose and distribute, but you should have a working environment and you can pick up from there.
I did have a problem using virtualenv and pip with Python 3, the question and solutions is available here.

Categories

Resources