I'm trying to get up and running with Python 3.5.2 and various packages on a server I work on, but don't have root privileges for. I installed Python to my home, and that seems to be working. I'm trying to set it up so I can install packages to that Python installation (ie ~/lib/python3.5/site-packages) via pip, but I cannot get it working.
Even after adding ~/lib/python3.5/site-packages to $PYTHONPATH, no luck.
Running pip install pandas, I get the error /usr/local/bin/python3.5: bad interpreter: No such file or directory , so it's still looking in the wrong spot. It should be looking at ~/bin/python3.5. Setting an --install-option="--prefix= argument doesn't change the problem.
Is this possible to do?
Try this:
pip3 install --user "library name"
Related
Overview: While running Python 3.6, after upgrading my arcgis package, scripts no longer recognizes many packages and pip itself completely broke, making it impossible to upgrade or uninstall any packages.
Background Info: Fairly recently, when I run a particular program of mine, I have been seeing a deprecation message connected to the arcgis package. So, I upgraded the arcgis package to see if it fixed it. It seemed to install correctly but then when trying to run my program, I'd get errors for other packages, like folium or requests. I then tried upgrading Python and initially, it worked. I used pip to install pandas and requests but right after I installed arcgis, everything broke again. So then when trying to uninstall arcgis (or do anything else pip related) I get this error:
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\Users\myuserpath\AppData\Local\.certifi'
I've uninstalled Python but it doesn't change anything. pip install any package results in this error. I tried reverting back to Python 3.6 but the installer wasn't available from the python site, only 3.9.
What could have been changed or affected by this arcgis installation?
There seems to be two primary issues you're dealing with. The first is as #BoarGules mentioned, that arcgis does a 'full' install with all its dependencies and that could be causing problems. Secondly, the newest requests library seems to have some issues as well, at least from what I've experienced. So let's get started fixing all this.
There's probably a few different ways to fix this, so this is just one of the many. First, uninstall python and delete the python folder from your AppData folder - in your case, it would be the Python 3.9 folder. Re-install Python and check your site-packages folder making sure it only contains the default Python packages. Open up a command prompt and do a pip install of something basic, like pandas. If that goes well, then the first hurdle is over.
When it comes time to install arcgis again, you'll want to use this instead
pip install arcgis --no-deps
this will prevent the doubling up of any of the packages or whatever seems to be happening. You will need to then also install these:
pip install ujson
pip install requests_ntlm
Next, when you come to installing requests, use an older library, like this one:
pip install requests==2.20.0
That should get things back up and running.
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.
I try a python code for signature recognition, and there is an import ffnet module (from ffnet import mlgraph, ffnet), but I got an error when I run it.
The error is:
ModuleNotFoundError: No module named 'ffnet'
I have install the module, but still got that error
Help me to fix this :)
You need to make sure that it is correctly installed. The error message means directly "You haven't installed it properly".
Depending on what Python version you're using, you should have a package manager called pip that takes charge of installing and uninstalling modules. Try:
pip2 install ffnet if you have Python 2.
pip3 install ffnet if you have Python 3.
Alternatively, you may have installed Python using Anaconda. In this case, use conda install ffnet. In all cases, run the proposed commands in a terminal.
However, it would be quite useful to have more details about your problem (what OS do you have, how and where did you install Python, what version do you have).
There is great chance that the pip (i suppose you use pip for installation, the idea is identical) you use to install ffnet is not correspond to the python you are using. Maybe a virtualenv is running, or you using python 2 but ffnet is installed with pip3
My suggestion:
- Run which pip. Run which python. Compare the results if anything seem wrong (python2 pip3 for example). Try to run python2 and pip2 instead of python and pip
- If the above suggestion doesn't work, you should try to recheck your PATH: Find the pip correspond to your current python (usually within the same dir) and export PATH=/path/to/THAT/pip/:$PATH
- If the problem still persist, I suppose your pip file's first line (for specifying its corresponding python path) has been modified without your awareness. You will have to manually edit it to something like #!/usr/bin/python3
Hope this help!
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.
I've just started trying to use Nitrous.io. I've made a box with python, and am trying to use pip to install a python package called praw.
It downloads all of the information fine, but on running the install script, I get an error stating that it could not create a file due to permission restrictions in the /usr directory. Is there any way to get around this as I need the package for my application to work properly.
You could try pip install --user praw
https://pip.pypa.io/en/latest/user_guide.html#user-installs