ModuleNotFoundError: No module named 'ezdxf' - python

I've installed ezdxf running following library in the same folder that my .py file is located, with this command:
pip install ezdxf
I see this error when hovering on import ezdxf
Import ezdxf could not be resolved Pylance
When I try to run the project it says:
ModuleNotFoundError: No module named 'ezdxf'
I've tried to install again, but I see this:
Requirement already satisfied: ezdxf in c:\users\robert\appdata\local\programs\python\python38\lib\site-packages (0.17.2b1)
Requirement already satisfied: pyparsing>=2.0.1 in c:\users\robert\appdata\local\programs\python\python38\lib\site-packages (from ezdxf) (3.0.6)
Requirement already satisfied: typing_extensions in c:\users\robert\appdata\local\programs\python\python38\lib\site-packages (from ezdxf) (4.0.0)
How could I solve this issue?

Related

ModuleNotFoundError: No module named 'hydra'

I'm trying to run a Python script but it gives an error immediately at the first line of code while trying importing hydra library via:
import hydra
The error i get is the following:
Traceback (most recent call last):
File "C:\Documenti\Python\01 Tool\02_Tool_Archive\calc_risk\src\main.py", line 3, in <module>
import hydra
ModuleNotFoundError: No module named 'hydra'
As the install via right click on the hydra does not work, i tried to google the error and found a possible solution via installing the hydra via pip install from the terminal - this is what i get after calling the pip install again after the first successfull installation:
PS C:\Documenti\Python\01 Tool> pip install hydra-core --upgrade
Requirement already satisfied: hydra-core in c:\users\mhlaca\appdata\local\programs\python\python310\lib\site-packages (1.2.0)
Requirement already satisfied: packaging in c:\users\mhlaca\appdata\local\programs\python\python310\lib\site-packages (from hydra-core) (21.3)
Requirement already satisfied: omegaconf~=2.2 in c:\users\mhlaca\appdata\local\programs\python\python310\lib\site-packages (from hydra-core) (2.3.0.dev0)
Requirement already satisfied: antlr4-python3-runtime==4.9.* in c:\users\mhlaca\appdata\local\programs\python\python310\lib\site-packages (from hydra-core) (4.9.3)
Requirement already satisfied: PyYAML>=5.1.0 in c:\users\mhlaca\appdata\local\programs\python\python310\lib\site-packages (from omegaconf~=2.2->hydra-core) (6.0)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\users\mhlaca\appdata\local\programs\python\python310\lib\site-packages (from packaging->hydra-core) (3.0.9)
I'm currently stuck. What can I try next? Using Python 3.10.7 and pycharm as IDE, but also tried visual studio - same error.

torch virtual env not working python 3.7 , what am i doing wrong?

so i installed pytorch using conda into a virtual env while referring to this video
https://www.youtube.com/watch?v=vBfM5l9VK5c
i have activated the env
now inside jupyter notebook i run
import torch
print(torch.__version__)
and it works but when ever i run this in .py file and run it through terminal it gives me this error
import torch
ModuleNotFoundError: No module named 'torch'
if I try to pip install pytorch it says
Requirement already satisfied: torchvision in c:\users\kiit\anaconda3\envs\torch\lib\site-packages (0.10.0)
Requirement already satisfied: numpy in c:\users\kiit\anaconda3\envs\torch\lib\site-packages (from torchvision) (1.20.3)
Requirement already satisfied: torch==1.9.0 in c:\users\kiit\anaconda3\envs\torch\lib\site-packages (from torchvision) (1.9.0)
Requirement already satisfied: pillow>=5.3.0 in c:\users\kiit\anaconda3\envs\torch\lib\site-packages (from torchvision) (8.2.0)
Requirement already satisfied: typing_extensions in c:\users\kiit\anaconda3\envs\torch\lib\site-packages (from torch==1.9.0->torchvision) (3.7.4.3)
so what is going on exactly??
You might have more than one python versions installed on your system i.e One with conda and one separately.
In order to check that, you can go to control panel --> Programs and features. There you can figure out how many python installations are present on your system. Delete the one you dont need and your problem will be resolved.
I found this answer that could be related:
https://stackoverflow.com/a/57753725
Credits to trsvchn for the above answer link.
Perhaps also try opening jupyter notebook from the command line if that doesn't work.

ModuleNotFoundError: No module named 'requests' - can not seem to solve in VS Code (Win 10)

I have looked at similar errors and the fixes I tried have not removed this error (yet).
Package Version
-------------- ---------
beautifulsoup4 4.9.2
certifi 2020.6.20
chardet 3.0.4
idna 2.10
lxml 4.5.2
pip 20.2.3
requests 2.24.0
setuptools 49.2.1
soupsieve 2.0.1
urllib3 1.25.10
There's my current installs which I got from the terminal in VS Code. So, from what I can see, it is all there.
When I run from inside VS Code (the play button top right) I get this error:
[local address of file], line 3, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Further information *edit
I did install requests this way from the VS Code Terminal window:
python -m pip install requests
The output states:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: requests in c:\users\[user]\appdata\roaming\python\python38\site-packages (2.24.0)
Requirement already satisfied: idna<3,>=2.5 in c:\users\[user]\appdata\roaming\python\python38\site-packages (from requests) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\[user]\appdata\roaming\python\python38\site-packages (from requests) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\[user]\appdata\roaming\python\python38\site-packages (from requests) (1.25.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\[user]\appdata\roaming\python\python38\site-packages (from requests) (2020.6.20)
Any ideas on fixing this or a set of routine troublecheckers? Thanks kindly
You need to select the python interpreter to be the same of your current environment.
do
which python
/your_path/bin/python
That will give you the path, make sure the Python interpreter on your left button (at VSC) matches the same path, if not make it match.

Why am i unable to load wordcloud in spyder (v 3.3.4)?

Whatever I do, I just cannot use wordcloud in Anaconda - spyder
import wordcloud
Traceback (most recent call last):
File "<ipython-input-104-dc1828f2a80e>", line 1, in <module>
import wordcloud
ModuleNotFoundError: No module named 'wordcloud'
After doing some research, I realised that I need to install packages through shell program. So I installed wordcloud using pip command
C:\Users\1025990\AppData\Local\Programs\Python\Python37-32\Scripts>pip install wordcloud
Collecting wordcloud
Using cached https://files.pythonhosted.org/packages/d4/95/d260ce89441d1f28192fa5a0a016f547829517b11cabe0079ab91c56f6cd/wordcloud-1.5.0.tar.gz
Requirement already satisfied: numpy>=1.6.1 in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (from wordcloud) (1.16.4)
Requirement already satisfied: pillow in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (from wordcloud) (6.0.0)
Building wheels for collected packages: wordcloud
Building wheel for wordcloud (setup.py) ... done
Stored in directory: C:\Users\1025990\AppData\Local\pip\Cache\wheels\0a\24\57\899dc50402fef8c355561bcfadfe36879def229e6d97424281
Successfully built wordcloud
Installing collected packages: wordcloud
WARNING: The script wordcloud_cli.exe is installed in 'c:\users\1025990\appdata\local\programs\python\python37-32\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed wordcloud-1.5.0
I understand that the warnings have nothing to do with the installation as changing the environment variables will eliminate it. I have done that (but not posting here)
After doing that I executed the shell command again
C:\Users\1025990\AppData\Local\Programs\Python\Python37-32\Scripts>pip install wordcloud
Requirement already satisfied: wordcloud in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (1.5.0)
Requirement already satisfied: numpy>=1.6.1 in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (from wordcloud) (1.16.4)
Requirement already satisfied: pillow in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (from wordcloud) (6.0.0)
I updated the setup tools in the shell as well
C:\Users\1025990\AppData\Local\Programs\Python\Python37-32\Scripts>pip install -U setuptools
Requirement already up-to-date: setuptools in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (41.0.1)
Now I check whether I can use wordcloud in spyder, so I run the command again
from wordcloud import WordCloud
Traceback (most recent call last):
File "<ipython-input-105-021e0a03a31f>", line 1, in <module>
from wordcloud import WordCloud
ModuleNotFoundError: No module named 'wordcloud'
I don't understand what I am missing. Please help!
is it possible that you have multiple python instances and installed it to another one than you are actually using? That's a common cause for this kind of problem.
get your actual version in your python console via import sys print(sys.executable) and check the site-package folder of this path for your module.

Cannot import name 'WordCloud'

I am using Jupyter Notebook and trying to build a wordcloud. Turns out there are some issues with the pillow package and the internet is full of talks around it. I was geetting the DLL error initially. I tried a lot of different things and not sure which one worked but right now, I am getting the 'cannot import name' error.
Some details from Anaconda Prompt-
>python -m pip --version
pip 18.0 from C:\Users\Kritika.Jalan\Anaconda3\lib\site-packages\pip (python 3.6)
>python -m pip install wordcloud
Requirement already satisfied: wordcloud in c:\users\kritika.jalan\anaconda3\lib\site-packages (1.5.0)
Requirement already satisfied: numpy>=1.6.1 in c:\users\kritika.jalan\anaconda3\lib\site-packages (from wordcloud) (1.15.0)
Requirement already satisfied: pillow in c:\users\kritika.jalan\anaconda3\lib\site-packages (from wordcloud) (4.0.0)
Requirement already satisfied: olefile in c:\users\kritika.jalan\anaconda3\lib\site-packages (from pillow->wordcloud) (0.45.1)
Details from Jupyter Notebook -
from wordcloud import WordCloud
ImportError: cannot import name 'WordCloud'
import PIL
print(PIL.PILLOW_VERSION)
5.0.0
What am I doing wrong here?
Mostly, having a can not import name error even after successful library installation, is result of conflict with your local file name and python library name.
Do you have your own python file in your local named wordcloud.py ?
If yes, that is causing conflict with wordcloud.py in python library.
Simply rename your script.
Thanks
You just need to change your file name that is same to the library name

Categories

Resources