Tensorflow_docs not showing up in environment's install window - python

I want to import tensorflow_docs in a PyCharm python file. The I've installed it by
pip install git+https://github.com/tensorflow/docs
In PyCharm, the interpreter's install window does not contain tensorflow_docs as a package. I tried
conda install git+https://github.com/tensorflow/docs
At first, attempting to install tensorflow_docs gave the readout:
"Requirement already installed in anaconda/..."
I uninstalled with pip and reinstalled from github, but it still won't show up in PyCharm.

This may not be the exact solution and just an idea, but try creating a new environment so there is a fresh state to build on top.

Related

Unable to import a module thats already installed

I did pip freeze and the module was there in the list. Yet when I try to import it, getting the error below:
ModuleNotFoundError: No module named 'pyttsx3'
The virtual environment is activated too.
I saw another thread regarding this same issue but it was too technical for me to understand.
What do I do now? I am a newbie to linux btw.
If you are using anaconda for virtual environment, it is possible that the pip file running your pip freeze command does not point to the pip executable within the environment. You can verify this by running which pip. If the resultant path does not contain your virtual environment name in it, it is likely that the issue is what I just mentioned above. The solution to that is to install pip inside your conda environment.
Ensure that you run the following commands after activating your conda environment.
conda install pip
now install whatever package you want using the pip install <package_name>

Installing modules in windows not in Anaconda

I installed anaconda and installed various modules in it. Later I uninstalled it but when I try to install packages in Python through command line, it says requirements already satisfied and doesn't install. I want to install modules in simple Python now not in anaconda. How to fix it? Also, if I have uninstalled anaconda, why do I get the requirements satisfied message?
I am not very clear what you are trying to achieve , but you can always install the packages in a new location , and point the Python script to the new locations.
Python -m pip install --target="New location" [package name]

Why do I have to run pip install <package name> sometimes and other times no?

Sometimes I have to run pip install on terminal so I can load the library on Jupiter Notebook. But sometimes I don't have to do anything besides running import
Why is that?
Because the Anaconda distribution comes with many packages (Anaconda package lists), which you can already import. If the distribution doesn't contain a package, you should first try to install it with conda install <package>. If the package is not part of conda, then you pip install <package>.

installing python 2.7 package with anaconda

I am trying to figure out how to install packages for the first time. I have downloaded Python 2.7 with the Anaconda distribution. When I go to terminal and I type:
pip install pandas-datareader
I see a message that the package was installed successfully. However, when I enter:
import pandas-datareader as pdr
into Spyder, I get the error:
No module named pandas-datareader
I think this might be because I am not installing the package in the right directory. I also tried:
conda install -c anaconda pandas-datareader
and got the same result. I know there are many posts about installing packages, but I am looking for a super basic beginner explanation for how to troubleshoot this. What directory should I save packages in? How do I navigate to that directory? How do I use terminal to download the package into that directory, etc.
Conda installs any package to a conda environment and pip installs python packages to any environment. Your best bet is to create an environment and conda install to that. For example,
conda create -n py35
activate py35
conda install package_name
Typing these into the command line will set up your environment, activate it, and install whatever package you want.
After following your link, I got it to work by entering
!pip install pandas-datareader
in the Spyder Ipython console!

How to import packages into Pycharm using PIP?

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.

Categories