Cannot find YAML module [duplicate] - python

This question already has answers here:
ImportError: No module named 'yaml'
(9 answers)
Closed 4 years ago.
I am currently trying to use my YAML file but I get an error when trying to run my programme when it reaches 'import yaml' line.
The error is shown below
ImportError: No module named yaml
Even though I was able to successfully install it
Collecting pyyaml
Installing collected packages: pyyaml
Successfully installed pyyaml-3.13
Any help would be great, thanks

which python
/home/user/anaconda3/bin/python
which pip
/home/user/anaconda3/bin/pip
These must match. Than you can run pip install PyYAML
For such problems I can recommend conda. Using conda all dependencies are matched.
Here is a description how to use environments with conda.
The good thing about this approach is that you can change the version of your software (e.g. python) at any time, not affecting your other projects.
Moreover you can use pip in it just as before.

Related

Why python didn't see nltk module? [duplicate]

This question already has answers here:
How do I use installed packages in PyCharm?
(14 answers)
Closed 4 months ago.
I cant run my programm because nltk module is missing but i just intstalled it and it just right here in the folder
I tried to reinstall my python, and tried to change python interpreter but nothing worked
How have you actually installed nltk?
You can check if it's actually installed with pip freeze.
What might be happening here is that you could have another version of python installed, so make sure that you actually call the same interpreter for checking and installing with pip, in your case E:/pythonProject1/Scripts/python.exe -m pip freeze and E:/pythonProject1/Scripts/python.exe -m pip install nltk

Download PyPi package manualy with all dependencies (without PIP) [duplicate]

This question already has answers here:
How to install packages offline?
(12 answers)
Closed 5 months ago.
I am not able to use PIP on this device, so I need to install a module manually. The only problem is that I have to install like 30 dependencies of this module. I would have to download, unzip, include and install them all one by one.
Is there any faster way, like downloading a module with all its dependencies included?
If all requirements are pip packages, a quick solution might involve creating a lean python environment on another machine, installing the package using pip, and then copying over all of the resultant wheel files to the restricted machine either via SSH or another method.

I can't imort pyPDF2 module in python [duplicate]

This question already has answers here:
"no module named PyPDF2" error
(10 answers)
Closed 2 months ago.
I have installed pyPDF2 module using pip install pyPDF2 command in it is successfully installed. But when I import pyPDF2 module i get error no module named pyPDF2
Probably because your pip is not for your python. Check if
which pip
which python
show the same parent directory.
If they don't you should use another pip inside bin of which python. Or, the following
python -m pip install
may use the proper pip for your python.

How to use opencv module in python(I'm using pycharm) [duplicate]

This question already has answers here:
Cannot find module cv2 when using OpenCV
(24 answers)
Closed 2 years ago.
Thanks to read my question.
I got homework to print figures and try to use opencv module.
I search internet and download opencv by using cmd.(pip install opencv-python)
But in pycharm, I can't use opencv module.
Error massage tells me
ModuleNotFoundError: No module named 'cv2'
I don't know about programming well, It's hard to me guess reason.
Some theory is my code file is in D drive, not C drive which pycharm or python is install.
If you have python version 3 and above:
pip3 install opencv-python
If you have python version 2 and above:
pip install opencv-python
If you have used these commands and installed the package successfully, there is a good chance that your pycharm is not using the python version that you have installed this package on.
If you just want to be assured that you have installed the package correctly use
pip list
and check if the opencv-python is in the list. If you are seeing this package in the list you should check the version of your pycharm python interpreter.
Checkout this link for more information:
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html

ModuleNotFoundError, but the package should be there [duplicate]

This question already has answers here:
ModuleNotFoundError: No module named 'requests' after pip install [duplicate]
(2 answers)
Closed 1 year ago.
Here is what I'm using:
Python 3.7.x on PyCharm 2018.2.4
Windows 10.
I'm following a tutorial about website parsing, but the struggle begins before I can even really start out.
I get the error message:
ModuleNotFoundError: No module named 'requests'
The package should be installed properly (pip3 install requests) and I run only that single version of python as far aI i know. I can find the package in the directory I'd expect it to be (C:\Users\Bob\AppData\Local\Programs\Python\Python37\Lib\site-packages).
I expect the same problem for the other package (beautifulsoup4), but the script doesn't even get that "far".
So, I'm aware that I must've done something incorrectly but I can't figure out what.
Any advice?
requests is a module which is needed for the script / the command you are trying to run but seems not to be part of the python installation or the python distribution you choose.
I can guess that you got the error while entering the following line:
>>> import requests
I would run the pip install request command from powershell and try to install the package:
python -m pip install requests
I do not know what you want to use python for but I usually advise to use a python distribution such as Anaconda which contains plenty of additional packages including requests.

Categories

Resources