Issue installing pip and pandas - python

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

Related

What is the difference between installing a package in my Windows CMD and in VS Code terminal?

I am doing this project where i need to install a package called Twint.
I want to install this package and use it's commands in my VS Code.
What happends when i for example type this in my Windows CMD?
pip3 install --user --upgrade git+https://github.com/twintproject/twint.git#origin/master#egg=twint
Because i can't type this in my VS code terminal, where i usually install packages with pip.
It will return an error that says ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?''
Now if i run this in my Windows Command it seems that i can't directly import the package in VS code?
Can anyone help me out with this confusion, where does the files get stored and how do i create good habbits around installing packages?
Hope someone understands what im struggeling with here.
Best
It is often the case that computers have more than one version of python installed and that editors like VS code use a different version than pip uses on the command line. pip installs packages where the version of python it is linked to expects them to be, but VScode doesn't know to look there.
It sounds like you have git installed where pip installs things, so you can upgrade from the command line without issue, but there's no installation of git where VScode is looking, so there's nothing to upgrade.
You either need to find where pip installs things and add it to the $PATH VScode uses, or try running a variation of python -m pip install --user git (specifying a specific url, or other things, as needed) from within VScode, which will ensure the package gets installed in a place that VScode looks for packages.
Download and Install git in your windows from here:
https://git-scm.com/download/win
Then add its installation bin path to your windows's environment path. Then you will find the git command at the command prompt globally.
This may solve you problem.

Using VSCode on Mac, can't get Python 3.8 to run, only Python 2.7.16

I just downloaded VSCode on my Mac as well as Python and pip. I downloaded the latest version of Python via VS Microsoft extensions and installed pip using Python -m ensurepip --upgrade. I have python 2.7.16 on my Mac as well, I believe from my OS (it's not something I downloaded). I am trying to use pip and Python in VSCode. I have my interpreter in my virtual environment set to Python 3.8.2, and I created the virtual environment using "python3 -m venv .venv". However, every time I check the python version (with Python --version) in the terminal, it returns Python 2.7.16. I check the pip version, and there is no command found. When I check the pip3 version, I get back the following warning:
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
You can invoke Python with '-m pip' instead of running pip directly to avoid this problem.
pip 21.3.1 from /Users/username/Library/Python/3.8/lib/python/site-packages/pip (python 3.8)
Whenever I run Python -m pip or Python -m pip3, it returns "no module named pip".
When installing Python, I got a warning that Python 3 was not on the PATH, but it did not fix the issue when I tried to add the path. Unfortunately, I don't have much experience adding a path so I may have done that incorrectly.
Finally, I installed streamlit via pip3. It resulted in the following message but seemed to install. However, it could not be resolved when I tried to import streamlit in my code.
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
You can invoke Python with '-m pip' instead of running pip directly to avoid this problem.
Defaulting to user installation because normal site packages is not writeable
How do I add Python 3 to my PATH and ensure that VSCode runs Python 3 instead of 2?
Simply always refer 'python3' rather than 'python'.
python3 --version
python3 -m pip install blahblahblah

How do you install Django & PIP?

I am having a nightmare tonight, I want to start learning some Django but I am running into quite a few problems while installing it.
I am following these tutorials - https://www.youtube.com/watch?v=UmljXZIypDc / https://www.youtube.com/watch?v=MEcWRk9w0t0
I installed Python 3.7.2 and confirmed the installation by typing 'python --version' into Terminal/Command Prompt.
I typed 'pip --version' into CMD and got this message in return "'pip' is not recognized as an internal or external command, operable program or batch file."
this is where I am stuck, I cannot continue any longer without completing this step, could anyone tell me where I am going wrong?
Thank you
edit: looks like it's a path issue, does anyone know how to do the following: how to I do this :
"Then add C:\Python37\Scripts path to your environment variable. Assumes that there is a Python37 folder in your C drive, that folder name may varied according to the installed python version Now you can install python packages by running pip install awesome_package_name"
You need to uninstall python and when you're installing python again , check on add python to PATH.It will remove the error
Can you be more specific as to which OS you are using? You can use pip also like python -m pip .... The -m part loads a python module It might just not be installed since it is a python module. On linux, for example you have to install pip separately (would be sudo apt-get install python-pip).
Run pip install django from windows command prompt instead of python shell.
Installing Django with pip
follow these to know more. https://docs.djangoproject.com/en/2.2/topics/install/
hope you will get it.

Getting erros trying to install a new package for Python

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.

pip command is not being recognized

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

Categories