how to get ggplot in ipython - python

I have a similar problem as this post, however this fix didn't work for me. I am working in Spyder, Python 3.6 and want to run ggplot. After installing ggplot with pip, I am still unable to locate the module
import ggplot
Traceback (most recent call last):
File "<ipython-input-5-1140326dc452>", line 1, in <module>
import ggplot
ModuleNotFoundError: No module named 'ggplot'
EDIT:
I have also installed it in Anaconda Prompt with
pip install ggplot
and followed with
conda install ggplot
but have this error message
PackageNotFoundError: Packages missing in current channels:
- ggplot

Because you are using the Spyder environment, you need to install ggplot in a different manner, as described in this post:
conda install ggplot

Related

Pyplot not installing with matplotlib

I know that this is quite a common problem but when I installed this package I can't seem to get pyplot to be imported with matplotlib. My computer is currently running Pop os and I am using Pycharm as my IDE. When I run anything involved pyplot I get an the console prints out
Traceback (most recent call last):
File "/home/msm/PycharmProjects/Beginner/testing.py", line 1, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package
I have already tried the following
sudo apt-get install python3-matplotlib in the terminal
Searching for the package within Pycharm
Updating Python
Any help would be greatly appreciated.
try:
pip install matplotlib
if it isn't working try:
pip install --upgrade pip
and try it again
if it isn't working again try start terminal with administrator and add python -m to head of code

Python 3.9 module not found after installing with pip

I have tried the following install commands -
python3.9 -m pip install plotly
pip3 install plotly
But jupyter notebook in vs code gives the following error
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-f6b2d252d652> in <module>
1 import pandas as pd
2 import numpy as np
----> 3 import plotly
ModuleNotFoundError: No module named 'plotly'
However, when I do the same code in a jupyter notebook through anaconda, it works. I would like to be able to use pip modules in vs code too as it is my favourite editor. I have tried changing the python version used in the jupyter notebook but it did not work.
Ps. I am using a mac
It's probably because VSCode is using the wrong version of Python.
Take a look at the bottom right corner. While I have Python 3.8 and 3.9 installed, VSC is using 3.7.6 version. You have to click there and select the correct version.

How to install packages in Anaconda environment in VScode?

I am running my code in VScode, my python interpreter being Anconda3\python.exe . When running the following code : -
from Ipython import display
I encounter the following error in the python terminal :
PS C:\Users\Clover\Desktop\Speech Recognition> C:/ProgramData/Anaconda3/python.exe "c:/Users/Clover/Desktop/Speech Recognition/ml_code_first.py"
Traceback (most recent call last):
File "c:/Users/Clover/Desktop/Speech Recognition/ml_code_first.py", line 11, in <module>
from Ipython import display
ModuleNotFoundError: No module named 'Ipython'
I've tried to install it on the conda terminal using :
pip install ipython
and it shows that requirement already satisfied which means the package is installed but why is this package not detected in VScode?
At least there is the warning from the conda developers: Never mix conda-forge installs and pip installs. This might help.

Module Not found - Plotly

When I run the following code in jupyter I am thrown a module note found error. but when i run the import function in python it works without any errors. The jupyter version i have is 4.4.0 but in anaconda navigator it shows 5.3.0.
import plotly
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-6361d2547ebc> in <module>
----> 1 import plotly
ModuleNotFoundError: No module named 'plotly'
I installed plotly using pip install plotly but it required restarting as anaconda failed to recognize the installation
Can you try the following command in anaconda prompt?
conda install -c plotly plotly
then import again, hope this can help you

pyfits and mayvi installed package in astroconda but not visible by spyder

I have installed astroconda. After activating astroconda by command source activate astroconda I typed spyder. Then in Spyder I imported some package import pyfits and from mayavi import mlab
I see this error:
Traceback (most recent call last): File "", line 1, in
ImportError: No module named pyfits
I checked with conda list and pyfits 3.3 is in installed package list. How tell Spyder to use this package?
Spyder it is not included by default in astroconda. So, when you load it, it uses the version in the Ananconda environment.
To solve this, you only have to install it in astroconda:
source activate astroconda
conda install spyder

Categories