I'm using python 3.7 (environment created by anaconda) and trying to run python code that uses some google libraries but I don't really know how to install them.
From PyCharm IDE (Settings -> Project Interpreter -> Available Packages) I cannot find those packages to install.
And from terminal, running 'pip install --upgrade oauth2client' or 'pip3 install --upgrade oauth2client' doesn't seem to work either.
What I don't understand is: to install packages/libraries on python 3.x, should i only use pip3? But what if there is more than one python environment? On which one pip will install those libraries?
If you're using Anaconda, you should also have an Anaconda Prompt (py37) program that functions like the terminal. Typing pip install --upgrade oauth2client into Anaconda Prompt (py37) will install the upgrade into your current python environment. Alternatively, you can use conda install with more options (including specifying which environment you want).
Related
I want to install a library called "Scrapy" for Python on Windows. The developers recommend installing the package using Anaconda instead of Python3. However, will i be able to use the package in Python3 or will i need to use Anaconda for Web Scraping?
Anaconda is loved because it simplify package management and deployment in Python(and R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN)
You get to keep your environment(program dependency) organized when using Anaconda.
With Anaconda, you can use any Python version, and libraries you need for a specific task. A workflow would be as follow(Assuming you have install Anaconda, and its available on your system path):
conda create -n scrap python=3.6
conda activate scrap
conda install -c conda-forge scrapy
Here we create environment called scrap with python version 3.6. We then activate it and install scrapy fron a conda channel forge.
While in this environment(scrap), you have access to Python 3.6 and scrapy. The best thing about this is that this is separate from your other Python and packages.
To get out of your environment,
conda deactivate
While in your environment, you can use both conda and pip to install packages to that environment. Always try finding packages in conda(plus it’s channels) before using pip, becsusr conda will check for packages compatabilities before installation. It will know which packages to upgrade or downgrade to avoid conflicts.
In few cases where a package is not in conda, then use pip.
Read more:
https://conda.io/docs/index.html
Anaconda is a python distribution which contains additional packages to the python it ships with. To have lightweight version of python (without many additional packages), you can install Miniconda. Anaconda and Miniconda come with the conda package manager. You can use it to install and update packages specific to its python distribution.
To install scrapy package using Anaconda / Miniconda, in the Windows Command Prompt simply type in:
conda install scrapy
In Anaconda you can install almost all python packages using conda install or pip install.
You have to goto Anaconda prompt and type in pip install Scrapy
Anaconda just simplified the installation, but you can also install scrapy through PyPi as
pip install scrapy
I'm using Python 3.6 on Pycharm venv (virtual environment provided by IDE)
Terminal kept telling me to upgrade my pip from old 10.0.1 to newer 18:
You are using pip version 10.0.1, however version 18.0 is available
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
So I upgraded my pip with the suggested command.
However, when I check my pip version by pip --version, it's still on 10.0.1 and pip keeps telling me to upgrade.
pip 10.0.1 from
h:\pycharmprojects\my_project\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip
(python 3.6)
I'm sure it's already up-to-date by checking IDE's interpreter settings.
I know it doesn't really matter but it bothers me pretty much.
I already tried closing and opening new terminal but that clearly doesn't work.
How do I use my newly installed pip? Is it just Pycharm's problem?
When you are using a virtual environment in pycharm, you update the version of pip inside that virtual environment.
If you want to upgrade pip outside of the venv, type
python -m pip install pip -U
Where python is how you start python from the terminal,
which may be python3 or py -3.6 depending on your operating system.
To install inside the virtual environment, you can activate
that inside the terminal and then type the above command.
If you run this command in your PyCharm terminal, it will resolve the warning about pip:
python -m pip install -U --force-reinstall pip
Here are some comments on the JetBrains community page
How do you install Python 3.6.x in a virtualenv using pip in Windows 10?
pip install python, pip install python3, pip install python3.6 don't work.
Pip and virtualenv are two separate tools. Pip is a package manager, you will use it to install packages into your virtual environment once it has been set up. Pip does not actually manage the virtual environment. Virtualenv is the tool that handles creating virtual environments.
First, you should check if you have virtualenv installed with virtualenv --version. If you do not have it, you will get an error that virtualenv is not found. You can use pip to install virtualenv with pip install virtualenv.
Once you have virtualenv, you can create a python 3.6 environment with virtualenv -p python3.6 /path/to/myvirtualenv. You will need an installation of python 3.6 for this command to work, so download and install python 3.6 first if you do not have it.
I believe that on windows if you don't have python 3.6 in your PATH variable, you may need to point directly to the python 3.6 installation instead with virtualenv -p /path/to/mypython3.6 /path/to/myvirtualenv.
See Virtualenv User Guide
I'm trying to install a package onto Pycharm using PIP. I am running Anacondas on a Pycharm IDE. I know that you use the project interpreter to install packages and I also know that the package should be located under PyPi but when I go to the project interpreter and click add package the package I'm trying to install doesn't appear under the list of available packages.
I know that you can install the package using PIP and I have PIP installed through Anaconda although I am unsure how to run a pip command through Pycharm. I've tried typing it into the cmd console and the python code and neither seems to have any effect...
The package I'm trying to install is: https://github.com/seatgeek/fuzzywuzzy.
The pip command to install it is: pip install fuzzywuzzy but I am unsure as to where I'm supposed to run that command.
I'm fairly new at Python so any help would be much appreciated!
Thank you!
I found someone else's answer that works for me:
You need to use
import pip
pip.main(['install','packagename'])
Which allows you to manually install packages through pip using Python code.
This is guide for installing the pip packages from Python Console in Pycharm IDE.
Do not forget to run Pycharm as administrator if you are using windows OS before installing the packages.
First of all import the pacakage of pip in python console.
import pip
Installation of Package.
pip.main(['install', '<package_name>'])
Examples
The below command will upgrade the version of package setuptools.
pip.main(['install','--upgrade','setuptools'])
The below command will install the scikit-learn and numpy packages.
pip.main(['install','numpy','scikit-learn'])
The below command will uninstall the scikit-learn package.
pip.main(['uninstall','scikit-learn'])
I was with the same problem, all i did was : Configure the project interpreter to the Python3 inside the venv you are using the pip install.
Remember to activate the venv.
That's it , now you can use the pip install on pycharm or on prompot.
The problem is that even with the "venv/lib/sitepackeges" in the your project's sys.path the pycharm looks only for the packages where the project interpreter is.
OSX: 10.9.5
PyCharm: 4.5
I am working on project in PyCharm IDE, using the 2.7.3 Python interpreter and need to import thepsycopg2 module. I tried to install the module with PyCharm, but it failed and asked me to do it manually:
Image of error message
So I typed that command in the bash shell, the module installed and now it shows up in the project interpreter 2.7.2 but not in 2.7.3 !!!!!
Maybe the pip version is too old? I upgraded pip from the bash shell: pip install --upgrade pip
python 2.7.2 shows version 7.1.0
python 2.7.3 shows version 1.5.6
You should open Preferenes > Project: (projectname) > Project Interpreter.
Choose the interpreter you want from the dropdown. If you have installed Python with Homebrew, as I have, then you maybe want to choose one of the python interpreters from the Cellars to ease usage of other packages you may have installed with Homebrew.
It might simply be that your system doesn't have pip installed, only pip3.
My system only showed me having pip3 not pip.
Use which pip3 and which pip to see if you have either.
I decided to update pip3, first trying pip3 install --upgrade pip3 which, oddly, returned: ERROR: No matching distribution found for pip3
Next, I ran pip3 install --upgrade pip and now PyCharm can install packages from the GUI.
You didn't specify what pip version you have. My guess is that the pip version is too old and PyCharm passing some flag which returns deprecation warning which cause it to fail. Try updating pip: pip install --upgrade pip