pip packages in Spyder - python

Pulling my hair out at this.
Just installed a pip package pyodbc but can't import it with Spyder.
Error:
ModuleNotFoundError: No module named 'pyodbc'
However if I just try from Python via CMD I have no issues.
I've added C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\site-packages (where the package was installed) to the PYTHONPATH manager in Spyder and restarted the kernal etc but to no avail.
This suggests I need to set up miniconda but surely I can do this with standalones?

Related

Spyder can't find installed modules with pip

I first installed Spyder and then afterwards Python on a server (with Windows Server 2019) all on the directory "C:\Users\wi932\ .spyder-py3" and the Python folder "C:\Users\wi932\Python\Python38". Then I installed many packages (like tensorflow, matplotlib, scikitlearn) by using the command prompt of windows and pip from the directory "C:\Users\wi932\Python\Python38\Scripts" and it was okay.
However, when running Spyder I can't use the packages that I installed using pip. Whenever I run a Python programm with those modules I get an error message "ModuleNotFoundError: No module named 'tensorflow'". So the question is how can I build a "connection" between the pip and Spyder?
Does anyone have an idea? I'll appreciate every comment.
Have you considered installing anaconda?
Spyder comes as a part of this and is easy to install from the anaconda client. You can also create your base environment in the anaconda client and then switch to pip to install packages from there.

Installed anaconda python libraries cannot be imported

I'm setting up a Python/conda enviroment on Ubuntu. I installed some common Python libraries such as tensorflow via conda install or pip install. Via pip show ... I found out they are all installed in the following folder: /home/anaconda3/lib/python3.8/site-packages/. However, when running them in Spyder I get the ModuleNotFoundError: No module named 'tensorflow' error message, for about every library (including matplotlib).
How can I fix this? I read this post about how they apparently need to be installed in /home/anaconda3/envs/[name env]/lib/python3.7/site-packages/ (/home/anaconda3/envs/ is an empty folder for me). However, the quick fix mentioned doesn't work for me.
Is there some way to add /home/anaconda3/lib/python3.8/site-packages/, use it as default, or is their a way to reinstall packages such that they will work?
Curiously enough, I did manage to get pygrib working via conda install -c conda-forge pygrib=2.0.1, but I'm not sure whether this is the way to go for all packages and would like to know what this does differently.

Pip3 and python are not synchronized | ModuleNotFoundError: No module named 'numpy'`

So my problem started when in Spyder I wanted to import library from python (wget). Even though module was clearly installed (through both pip and conda) Spyder couldn't see it.
I tried to resolve the issue.
Firstly I reinstalled python - still same issue.
Now I try to reinstall whole conda environment.
But even though I removed conda after uninstalling modules for example numpy pip3 uninstall numpy, then installing pip3 install numpy I still get Error: ModuleNotFoundError: No module named 'numpy'
Honestly guys I have no clue now how can I resolve my issue and setup my python environment once again.
I'm running everything on macOS terminal.
So apparently reinstalling conda helped me to solve the problem.
The environment seems to be working fine.
For macOS I removed:
rm -rf ./anaconda3 from opt folder in users
removed anaconda3 from PATH
removed all anaconda3 dependencies
I leave the post, because maybe someone has the same issue.

Pycharm Module Installation: ModuleNotFoundError: No module named 'utilities'

I am using Pycharm Virtual Environment for a project and working on windows 8.1 x64. Trying to do image processing on python and for this needed to import utilities. The package is present at this link. https://pypi.org/project/utilities/
In my code i am using these commands:
from utilities.utilities import Utilities as Utils
import utilities.constants as Constants
and when I try to do pip install utilities or try to install the package from settings, even though it is present there but it gives these errors
ModuleNotFoundError: No module named 'utilities'
How can I install this package if I cannot use pip then how do i manually install from package. Please guide on both.

ImportError: No module named pyreadability in conda env

in my python code I've got the line:
from pyreadability import pyreadability as pyrb
And I'm getting the error :
ImportError: No module named pyreadability
I'm in Ubuntu, using python 2.7 and running code inside a conda env named mzh27.
I already tried these commands but none of them made the error solve
pip install PyReadability
conda install -c anaconda lxml
/home/{usr}/anaconda2/envs/mzh27/bin/pip install PyReadability
pip install readability-lxml
/home/{usr}/anaconda2/envs/mzh27/bin/pip readability-lxml
In all of those cases, the module installed successfully but error was still there.
Any Idea what to do for it?
The problem was the repository I've cloned was missing the file named pyreadability.py. The package was not the one I thought. It was implemented by the repository owner (who forgot to add files to the repository) and just have similar names to python packages that are available to install.

Categories

Resources