I am installing python and Django on my shared host server. I have followed the guide located here to install python and pip
http://flailingmonkey.com/install-django-justhost/
As I've encountered the problem of python never using 3.4.2 I've followed a different guide to install python 3.4.2 which is here
http://joemaller.com/1717/building-python-on-shared-hosting/
After I installed python, I went back to follow the first guide to instlall setup tools and pip.
I've ran all the commands it said and when I look inside python3.4.2/bin folder I see pip pip3 and pip3.4 files there so that tells me that pip was installed. However whenever I try to use pip instlal Django it says -bash: pip: command not found. I'm just wondering if I am missing a step somewhere?
The path is set incorrectly so adding so add the following to .bashrc:
export PATH=$HOME/opt/python3.4.2/bin:$PATH
And then source ~/.bashrc.
You could try to write this in consol to install pip
easy_install pip
Related
I am trying to install Pandas with Pip and am running into some strange issues. Command prompt reported that pip is an unrecognized command. I thought that was strange, but decided to definitively remedy that by installing pip with the following commands:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
I received the report that an existing version of pip was found, uninstalled, and the new version was installed. I then proceeded to run
pip install pandas
And I was informed that 'pip' is not recognized as an internal or external command, operable program or batch file.
I then added to the path environment and the issue is still persisting. It's worth noting that I installed Python 3.6 by installing Anaconda. What am I missing here?
The pip command is not found because it's not in your path.
You should add the following to your PATH environment variable:
;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\
A simple Google search should help you find how to change environment variables for you version of Windows.
For example, see this page from the Java documentation.
Try the following
C:\Users\Username>cd C:\Python27\Scripts
C:\Python27\Scripts>pip freeze
If you're using a different Python version, replace Python27, with your version of Python.
On windows you can use !pip install pandas in your Python program without having to open the windows/anaconda prompt.
But as others said, pip is not in your active directory and you would have to open the anaconda prompt or go to the library where pip is installed
I'm trying to teach myself python, and I feel out of my depth. To start, I am working on a mac which already comes with python 2.7 installed.
I installed python 3.6 recently and have been using it to teach myself the basics. I'd like to eventually learn how to produce mathematical plots in python, and I know I will need the matplotlib package to do that.
Following some advice online, I was told that python3 already comes with pip installed, which is what I thought I should use to install matplotlib. The advice said I should type the following into the mac terminal:
python3.6 -m pip install matplotlib
I typed this, and it seemed like the package was installing, but I ended up getting some sort of error code that said:
Command "python setup.py egg_info" failed with error code 1 in [folder].
I tried opening IDLE and typing "import matplotlib", but I got the error: "no module named matplotlib". I also tried typing "import matplotlib.pyplot as plt", but I got the same error.
Based on further research and this youtube video, I've decided to just install miniconda in order to have access to the matplotlib package.
The problem is, I'm not sure if I should somehow be uninstalling whatever was installed when I ran the code above to install matplotlib. I've actually run that line of code 3 or 4 times. Should I remove anything before installing miniconda? Also, I am running python 3.6, while miniconda is listed on the website as being for python 3.5. Does this mean it won't work for my version of python?
Running pip like that would install packages system-wide. I'm guessing it's failing because you're not running as root (i.e. the administrator user). But wait! Don't try again as root! Instead of installing packages, do it in a virtual environment. First create it:
virtualenv myenv
This creates a directory called myenv with a bunch of stuff in it (so make note of where you run this command). Whenever you want to use the virtual environment (like straight away!) you first need to activate it:
. myenv/bin/activate
Don't miss out that dot (followed by a space) at the beginning! As the other answer says, the first thing you should do in it is upgrade pip:
pip install --upgrade pip
Now you're ready install whatever else you like:
pip install matplotlib
One last note: The virtual environment is tied to a particular Python version. By default it uses the system's Python 2.7 installation, so to use a different one you need to specify it when you create the virtual environment, like this (if that Python version is installed system-wide):
virtualenv -p python3.5 myenv
Or like this (if that Python version is not installed system-wide):
virtualenv -p /path/to/my/installation/of/python3.5 myenv
While the virtual environment is activated, you don't need to specify the particular path/version of Python. Just run it like this:
python
I also encountered many problems during my installation.
It seems that version 2 of matplotlib is not compatible with Python version 3.
Finally, I succeeded by specifying version 3 of matplotlib as follows with the following command:
sudo apt-get install python3-matplotlib
Reference from the Matplotlib website:
https://matplotlib.org/users/installing.html#building-on-linux
Try upgrade setup tools
--upgrade setuptools
or
easy_install -U setuptools
or upgrade pip
pip install --upgrade pip
I ended up downloading anaconda and using the python interpreter that comes with it, as anaconda comes with matplotlib and many other python packages of interest.
the pip command typically is for the Python 2. use pip3 instead to install the libraries in the python 3.X path
This should work
pip3 install matplotlib
The solution that work for me in python 3.6 is the following
py -m pip install matplotlib
Matplotlib files are downloaded in ~/.local/lib/python3.6/site-packages/ and not in /usr/lib/python3.6/ .
Try the command:
sudo cp -r ~/.local/lib/python3.6/site-packages/* /usr/lib/python3.6/
I have spent hours trying to install a new package for Python (XlsxWriter) but Ican't figure out how to do it. (I am using Python 2.7.10)
I download the two files from here and copied them into my main Python directory:
https://pypi.python.org/pypi/XlsxWriter
In their documentation they recommended using
'pip install XlsxWriter' to install.
I followed the instructions to install pip from here (downloading file and running 'python get-pip.py'):
https://pip.pypa.io/en/latest/installing/#install-pip
That seemed to work but when I type 'pip install XlsxWriter' it still says "'pip' is not recognized as an internal or external command" e.t.c.
Also, as I had downloaded a tarball, I tried the line tar -zxvf XlsxWriter-0.7.7.tar.gz but it just says tar isn't a recognised command again.
If I load python in the command prompt by just typing 'python' and then try the above commands it just says invalid syntax
Where am I going wrong?
Sorry this is so simple but I have no one to ask in real life and have followed the instructions to install python packages in a few places but still can't get it to work.
try python -m pip install XlsxWriter
invoke it as a python module... Your path may not be properly set to just recognize pip
Add your python installation bin folder to your environment path
The problem is your pip installation. You have make pip work first:
http://pip.readthedocs.org/en/stable/installing/
Then you can do pip install XlsxWriter without downloading the package first.
Alternatively you can unpack the archive (tar -xvf XlsxWriter-0.7.7.tar.gz on Linux/Mac) and then do python setup.py install.
I uninstalled django on my machine using pip uninstall Django. It says successfully uninstalled whereas when I see django version in python shell, it still gives the older version I installed.
To remove it from python path, I deleted the django folder under /usr/local/lib/python-2.7/dist-packages/.
However sudo pip search Django | more /^Django command still shows Django installed version. How do i completely remove it ?
pip search command does not show installed packages, but search packages in pypi.
Use pip freeze command and grep to see installed packages:
pip freeze | grep Django
Got it solved. I missed to delete the egg_info files of all previous Django versions. Removed them from /usr/local/lib/python2.7/dist-packages. Also from /usr/lib/python2.7/dist-packages (if any present here)
sudo pip freeze| grep Django
sudo pip show -f Django
sudo pip search Django | more +/^Django
All above commands should not show Django version to verify clean uninstallation.
Use Python shell to find out the path of Django:
>>> import django
>>> django
<module 'django' from '/usr/local/lib/python2.7/dist-packages/django/__init__.pyc'>
Then remove it manually:
sudo rm -rf /usr/local/lib/python2.7/dist-packages/django/
open the CMD and use this command :
**
pip uninstall django
**
it will easy uninstalled .
first use the command
pip uninstall django
then go to python/site-packages and from there delete the folders for django and its site packages, then install django. This worked for me.
Remove any old versions of Django
If you are upgrading your installation of Django from a previous version, you will need to uninstall the old Django version before installing the new version.
If you installed Django using pip or easy_install previously, installing with pip or easy_install again will automatically take care of the old version, so you don’t need to do it yourself.
If you previously installed Django using python setup.py install, uninstalling is as simple as deleting the django directory from your Python site-packages. To find the directory you need to remove, you can run the following at your shell prompt (not the interactive Python prompt):
$ python -c "import django; print(django.path)"
I had to use pip3 instead of pip in order to get the right versions for the right version of python (python 3.4 instead of python 2.x)
Check what you got install at:
/usr/local/lib/python3.4/dist-packages
Also, when you run python, you might have to write python3.4 instead of python in order to use the right version of python.
On Windows, I had this issue with static files cropping up under pydev/eclipse with python 2.7, due to an instance of django (1.8.7) that had been installed under cygwin. This caused a conflict between windows style paths and cygwin style paths. So, unfindable static files despite all the above fixes. I removed the extra distribution (so that all packages were installed by pip under windows) and this fixed the issue.
I used the same method mentioned by #S-T after the pip uninstall command. And even after that the I got the message that Django was already installed. So i deleted the 'Django-1.7.6.egg-info' folder from '/usr/lib/python2.7/dist-packages' and then it worked for me.
The Issue is with pip --version or python --version.
try solving issue with pip2.7 uninstall Django command
If you are not able to uninstall using the above command then for sure your pip2.7 version is not installed so you can follow the below steps:
1)which pip2.7
it should give you an output like this :
/usr/local/bin/pip2.7
2) If you have not got this output please install pip using following commands
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python2.7 get-pip.py
3) Now check your pip version : which pip2.7 Now you will get
/usr/local/bin/pip2.7 as output
4) uninstall Django using pip2.7 uninstall Django command.
Problem can also be related to Python version.
I had a similar problem, this is how I uninstalled Django.
Issue occurred because I had multiple python installed in my virtual environment.
$ ls
activate activate_this.py easy_install-3.4 pip2.7 python python3 wheel
activate.csh easy_install pip pip3 python2 python3.4
activate.fish easy_install-2.7 pip2 pip3.4 python2.7 python-config
Now when I tried to un-install using pip uninstall Django Django got uninstalled from python 2.7 but not from python 3.4 so I followed the following steps to resolve the issue :
1)alias python=/usr/bin/python3
2) Now check your python version using python -V command
3) If you have switched to your required python version now you can simply uninstall Django using pip3 uninstall Django command
Hope this answer helps.
If installed Django using python setup.py install
python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)"
find the directory you need to remove, delete it
I'm using the most recent versions of all software (Django, Python, virtualenv, MySQLdb) and I can't get this to work. When I run "import MySQLdb" in the python prompt from outside of the virtualenv, it works, inside it says "ImportError: No module named MySQLdb".
I'm trying to learn Python and Linux web development. I know that it's easiest to use SQLLite, but I want to learn how to develop larger-scale applications comparable to what I can do in .NET. I've read every blog post on Google and every post here on StackOverflow and they all suggest that I run "sudo pip install mysql-python" but it just says "Requirement already satisfied: mysql-python in /usr/lib/pymodules/python2.7"
Any help would be appreciated! I'm stuck over here and don't want to throw in the towel and just go back to doing this on Microsoft technologies because I can't even get a basic dev environment up and running.
If you have created the virtualenv with the --no-site-packages switch (the default), then system-wide installed additions such as MySQLdb are not included in the virtual environment packages.
You need to install MySQLdb with the pip command installed with the virtualenv. Either activate the virtualenv with the bin/activate script, or use bin/pip from within the virtualenv to install the MySQLdb library locally as well.
Alternatively, create a new virtualenv with system site-packages included by using the --system-site-package switch.
source $ENV_PATH/bin/activate
pip uninstall MySQL-python
pip install MySQL-python
this worked for me.
I went through same problem, but using pip from virtualenv didn't solve the problem as I got this error
error: could not delete '/Library/Python/2.7/site-packages/_mysql.so': Permission denied
Earlier I had installed the package by sudo pip install mysql-python
To solve, copy files /Library/Python/2.7/site-packages/MySQL_python-1.2.5-py2.7.egg-info and /Library/Python/2.7/site-packages/_mysql* to ~/v/lib/python-2.7/site-packages and include /usr/local/mysql/lib in DYLD_LIBRARY_PATH env variable.
For the second step I am doing export DYLD_LIBRARY_PATH=/usr/local/mysql/lib in ~/.profile