This question already has answers here:
PIP install a Python Package without a setup.py file?
(2 answers)
Closed 5 years ago.
I am new to python and I am having trouble downloading a module from GitHub: https://github.com/petercerno/good-morning
I have looked online for solutions, but each solution I try does not work. I have tried:
pip install https://github.com/petercerno/good-morning.git
I get an error that says, "Cannot unpack file" & "Cannot determine archive format." I have no idea why I am getting this error.
Just save good_download.py and good_morning.py to the same directory as your Python script, and then import them:
import good_morning
import good_download
# do stuff!
Related
This question already has answers here:
ImportError: No module named 'pygame'
(25 answers)
Closed 1 year ago.
Im using vs code and when I write the command "pip install pygame" it tells me this "Requirement already satisfied: pygame in /usr/local/lib/python3.9/site-packages (2.0.1)" However, when I try to import pygame it doesnt work. It simply states "line 1, in <module> import pygame ImportError: No module named pygame"
If anyone can help me that would be awesome :)
I think you need to set up your virtual environment. https://code.visualstudio.com/docs/python/environments
But i would recommend you to you use PyCharm, when you create project it automatically creates venv for you and you dont need to care about it.
This question already has answers here:
Pylint "unresolved import" error in Visual Studio Code
(40 answers)
PyLint "Unable to import" error - how to set PYTHONPATH?
(33 answers)
Imports failing in VScode for pylint when importing pygame
(3 answers)
Closed 1 year ago.
I’ve downloaded pygame but VS code says, in the problems section , it is “Unable to import ’pygame’ pylint(import-error)”
In the terminal it says “ModuleNotFoundError: No module named ‘pygame’”
What could be causing it to not import?
Edit: I added some more specifics
I'm pretty new to python, but I'll try to give you a solution.
You could create a virtual environment in your terminal. If you don't know how to do that, here's a link to a website I found for macos, https://sourabhbajaj.com/mac-setup/Python/virtualenv.html. For windows, https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html. Activate the virtualenv, and then pip install pygame inside the virtualenv, so when you run your code, pygame should work as long as the virtualenv you downloaded pygame in is activated.
I really hope this helps as this is my first time answering a question on stackoverflow!
This question already has answers here:
PyCharm error: 'No Module' when trying to import own module (python script)
(17 answers)
Closed 1 year ago.
I am using PyCharm and am having trouble importing modules
I set up a venv and imported the dependencies via pip install -r
When I try to run the application and get 'module not found' for all imports.
If I open a terminal in PyCharm and do pip list all the required modules are listed
Further PyCharm can file the modules - I can perform completion when typing the name of the module.
What else can I try?
Sounds like you have more than one python environment on your machine.
So, in my opinion, you need to manage the environments in python IDE.
The same happened to me so this helped me in that.
Do check: https://docs.python.org/3/tutorial/venv.html
You can also seek help from the below article:
https://www.freecodecamp.org/news/manage-multiple-python-versions-and-virtual-environments-venv-pyenv-pyvenv-a29fb00c296f/
I solved this by checking the boxes 'Add content toots to PYTONPATH' and #Add source roots to PYTHONPATH'
This question already has answers here:
Installing python module within code
(12 answers)
Closed 3 years ago.
I have some code that uses modules that are not installed by default (eg. Numpy), and I want to give the program to a friend of mine who does not have that module.
I do not want him to have to go through the tedious process of using cmd to install the module. Is there any way to install the module from within the code itself? Like:
import pip
pip.install('numpy')
(completely hypothetical)
BTW: I am using Windows 10
from subprocess import call
module=input('Name module: ')
try:
call(['pip', 'install', module])
except Exception:
print('Error')
This question already has answers here:
logistic_sgd module, where to find it?
(4 answers)
Closed 5 years ago.
Now, I am using anaconda 2 and python 2.7 to try to complete an auto-encoder problem. The code on the internet requires "import logistic_sgd". However, when I wrote "pip install logistic_sgd" in my cmd, I get:
could not find a version that satisfies the requirement logistic_sgd
No matching distribution found for logistic_sgd
Can someone help me solve the problem?
logistic_sgd.py is a file you need to download: http://deeplearning.net/tutorial/code/logistic_sgd.py