Getting a Module not found error when installing various packages - python

I am trying to import various modules, like nltk and pandas, using Jupyter notebook. While I have created a virtual environment and installed the packages (I received an all packages installed message on terminal), I keep getting that error on Jupyter notebook. Could I get help for this please? Thanks!(this is what the error looks like:
https://i.stack.imgur.com/rwkqW.png)

We need more information are you using anaconda or are you not are you using pip3? Perhaps if you are try " sudo pip3 install pandas. "

Related

Why doesn't import gym work; however, the command pip install gym was done and executed

I have went to the terminal and used,"pip install gym", and it successfully installed gym . When I go to use the, "import gym," command, I get an error when running the code at that line.
Exception has occurred: ModuleNotFoundError
No module named 'gym'
I have looked at other posts and they all say it should work after ruining,"pip install gym." Although mine successfully installed, it still doesn't work.
You need to verify that you are using the same version of python that you did pip install with. In VS Code, you can select the Python version in the upper right corner. Simply type "python --version" into the console to verify the version. You might want to use Anaconda because someone libraries like Tensorflow only fully-support Anaconda.
if you have pip installed it, there is no way that it will not work. Unless you've installed it to a virtual environment and running your program without it and vice versa. Or you've installed to a different version of python on your system.

Error running jupyterlab via pip install in python 3.9

Hello I am fairly new to Python and I'm trying to get started with data visualization. I pip installed jupyter lab but it gave the error of jupyter-troubleshoot.exe and jupyter.exe are installed in 'C:\Users\myusername\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p which is not on PATH. I have had problems in the past with accessing csv files using VSCode so I think there might be an issue with my directory. How do I change this to PATH so the jupyterlab runs?
Thank you!

ModuleNotFoundError: No module named 'mlxtend' despite mlxtend being in pip list

I am using Python 3.8.6, with mlxtend version 0.17.3, doing this on jupyter notebook
I have installed mlxtend in my virtual environment on command prompt with
pip install mlxtend
and it also shows up on my pip list.
However when I am trying to import the module within VS Code, and selecting my venv as my python interpreter:
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
I am facing the error:
ModuleNotFoundError: No module named 'mlxtend'
Appreciate any help.
Try pip list or import mlxtend in the console displaying error message. If it wasn't present there, it was an environment configuration problem. Then you can just install the module there using pip.
I remember one of my friends having same problem with some other module. He was also using some kind virtual environment, which I guess caused the problem.
The error is because of environment, and I had a similar problem, but I solved it by adding the isntalled library, in the Interpreter settings, but I did this in PyCharm, look for similar options in VS Code.
P.S. I will update if I found the option in VS.

Unable to install Pandas on Pycharm, Recieving error

I am trying to get Pandas to work on my Pycharm environment. I have installed it through the command:
pip install pandas
But when I run the code in my environment, import pandas as pd
I get the error:
No module named 'pandas'
When I try to install it using the project interpreter in Pycharm, I get the error:
error occurred when installing package 'pandas'
EDIT:
I didn't state what happens when I look into this error. I click 'Details'.
Then it says:
AttributeError: module 'pip' has no attribute 'main'
Perhaps this may tell us something about the issue
The error is identical to the one reported here Module pip has no attribute 'main'
For pip version 10.x and higher you should update Pycharm to 2018.2.
Or simply run pip in a terminal outside of Pycharm
Which Python version are you using? If you are using Python3, then the correct command is pip3 install pandas.
Make sure that the pip command you are calling refers to the same python that you are running. Try pip -V for more information.
-Update your pycharm to the latest version
-Update pip to the latest version and ensure its same as the python.exc
-Run pip install pandas command as an administrator
-Try installing pandas again
Apparently, you installed Pandas for python2 by pip. For python3, you need to use pip3.
However, it doesn't matter regarding your problem. Probably, you don't choose the right project interpreter.
For Pycharm, it supports the system python(2 and 3), as well as the virtual environment. You may install the Pandas module in system python, but use the virtual environment as default.
Simple solution
Make sure you select the interpreter you want (system or
virtualenv);
Check package list, if there is Pandas module;
If yes, refresh the project list;
If not, simply click + to search Pandas and install it to your
project interpreter.

Missing dependencies (numpy) when importing pandas

I'm following a Python tutorial where pandas is used and I'm running into a dependency issue that I can't figure out.
To install pandas, I ran:
pip install pandas
But when I open a python session and try to import pandas I get an error message saying "Missing required dependencies ('numpy')" despite the fact that I see it getting installed when I run the pip command to install pandas.
Help would be appreciated. Thanks.
Edit: Full error message posted below:
PS C:\Python> python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\__init__.py", line 19, in <module>
    "Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
try to install Anaconda 3 (it works on Windows and Linux), it contains all the useful libraries like panda, numpy... so you don't have to download or rebuild yourself

Categories

Resources