I'm receiving this error although it works fine in the idle shell?
I am currently working through the Automate The Boring Stuff book.
I tried to search for which directory it was saved to but when I reach c:\users\Jibby\appdata\local\programs\python the only thing in the python folder is a folder named mu.
Edit: Apologies for not going into more detail, I already have it installed > I get this message when I try to pip install it again "Requirement already satisfied: pyperclip in c:\users\jibby\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.8.2)"
It's just that when I try to run a batch file using an import pyperclip statement, it refuses to acknowledge that I have it installed. That's what I was trying to show in the Error Code photo by showing it imports fine in the IDLE shell but doesn't work when trying to run said batch file.
My error:
You have to install pyperclip from cmd with
pip install pyperclip
Be sure to read Appendix A for how to install third party modules (including pip)
try to type into the command promt:
"pip install pyperclip"
https://pypi.org/project/pyperclip/
Got it to work by typing in "py -m pip install pyperclip" into the command line.
I am starting a custom package called nate-givens-toolkit.
I want to use a module from that package in a Jupyter notebook in a different folder.
Here is my structure
- nate-givens-toolkit/
- setup.py
- nate_givens_toolkit/
- cloud_io.py
- __init__.py
- project/
- project_nb.ipynb
I am going into nate_givens_toolkit (in the console) and running: pip3 install .
The output I get looks like everything is just fine.
Processing /home/ec2-user/nate-givens-toolkit
Building wheels for collected packages: nate-givens-tooklit
Building wheel for nate-givens-tooklit (setup.py) ... done
Created wheel for nate-givens-tooklit: filename=nate_givens_tooklit-0.1-py3-none-any.whl size=2009 sha256=7de8c9d2930d531603c973c7d8079b66f3d4326fb274e63087128fb7d25d9e1b
Stored in directory: /home/ec2-user/.cache/pip/wheels/17/96/2f/0073c92cfdadbb032d855f24df4725bf190d39cd1c5bb1d233
Successfully built nate-givens-tooklit
Installing collected packages: nate-givens-tooklit
Attempting uninstall: nate-givens-tooklit
Found existing installation: nate-givens-tooklit 0.1
Uninstalling nate-givens-tooklit-0.1:
Successfully uninstalled nate-givens-tooklit-0.1
Successfully installed nate-givens-tooklit-0.1
But if I go into project_nb.ipynb and write:
from nate_givens_toolkit import cloud_io as cloud
I get: ModuleNotFoundError: No module named 'nate_givens_toolkit'
The same thing happens if I run python from the console. As long as I'm in the nate-givens-toolkit directory I can import and run it fine. But if I navigate up a level and try the import I get ModuleNotFoundError.
I don't understand why pip install seems to work, but I still get this ModuleNotFoundError. I thought the whole point of the pip install would be that I could then import from files in other directory without having to worry about relative paths and such. (I've done this exact same thing in a totally different context for work and it was fine.)
I've tried the solutions for similar issues like these:
after pip successful installed: ModuleNotFoundError
ModuleNotFoundError: No module named 'requests' after pip install
So far, haven't found anything that works.
Everything I'm doing is inside the same conda venv.
Help?
I found the answer to my question here: Import py file in another directory in Jupyter notebook. (Note: it wasn't the accepted answer on that post, it was the second answer after the accepted answer.)
The trick is that I needed to do use the -e flag when using pip install.
So instead of
pip install .
I had to run
pip install -e .
Once I ran that, it worked in Python from the console and also in Jupyter.
i have installed the youtube-dl module via pip with pip install youtube-dl and it worked. I can use it in CMD but for some weird Reason Python says that the Module doesnt exist:
Extension 'cogs.music' raised an error: ModuleNotFoundError: No module named 'youtube_dl'
this problem usually happens when there is more than one python version on the computer, download the modules according to the version you want to use
if this is didn't work for us do like bottom steps
go your python libs path and look up you must got this ........\lib\site-packages\youtube-dl
if you havn't got, go pypi site and download packets
after that, take out this file to ......\lib\site-packages
you should see like this :
or you can do like this:go your python path and open cmd and start writing:
......\python.exe -m pip install youtube_dl
Try the following command.
pip3 install --upgrade youtube-dl
I am trying to install opencv3.0 on my ubuntu system. I installed it according to link : http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/#comment-429946
At the end, in the terminal,when I try to import cv2, it works. But in the python IDLE it does not work. It gives the error : "No module named cv2".
Also, whenever I try to enter workon cv command, it says : "Error: deactivate must be sourced. Run 'source deactivate'instead of'deactivate'."
Althoug it gives error, I can get in cv environment((cv) ali#ali-pc:~$ ).
I am new to ubuntu and opencv. Thanks
Maybe its because of your IDLE interpreter settings. I use Pycharm and set to project interpreter path to my virtualenv interpreter with installed opencv-python. After this import works.
Try by giving version
pip install opencv==4.1.0.25(latest version)
Check
pip list
If not listed search location of python
which python
Search for site-packages folder inside resultant location of 'python' (usually under lib/python3.5/site-packages) and check if opencv-python present or not(packages are not installing right location)
sudo apt-get install opencv-python
I have installed python 2.7.10 with PATH access and correctly installed twilio. However, when I try to execute a code I get this error message
Traceback (most recent call last):
File "C:\Users\tmslvo\Google Drive\Desktop\send text.py", line 1, in <module>
from twilio.rest import TwilioRestClient
ImportError: No module named twilio.rest
Now I read that a reason might be that python can't find the twilio package so I tried the
which -a python
which -a twilio
commands (in my Windows command prompt) in which case I get
'which' is not recognized as an internal or external command,
operable program or batch file.
Does anybody have an idea of what I'm doing wrong?
Thank you!
Twilio developer evangelist here.
I think your problem will be that somehow when you installed the library, it failed silently(?). A few things to keep in mind:
When installing Python libraries, always make sure you use pip.
Also, check that none of your files within the project are actually called twilio.py as this will conflict with the actual library.
Check that you're using the version of Python you think you're using by running python --version
All that failing, run the installation again, and all going well (without errors), you should be able to test it quickly with the following code.
import twilio
import twilio.rest
try:
client = twilio.rest.TwilioRestClient(account_sid, auth_token)
message = client.messages.create(
body="Hello World",
to="+14159352345",
from_="+14158141829"
)
except twilio.TwilioRestException as e:
print e
try this: sudo pip3 install twilio --upgrade
I had this problem as well.
In my case, I had named my file twilio.py and that is what caused the error.
Renaming the file to send_sms.py ( or any other name of your choice) will resolve the issue!
Close and then relunch all IDLE instances.
This sounds obvious but it worked for me, since the installations of components were successful
I ran into this same issue. I had used easy_install instead of pip to install twilio which was the problem. To fix this I ran pip uninstall twilio and reinstalled using pip.
rename file name other than twilio.py
EX:send_sms.py
A bit late to the party here but I also ran into this issue.
After some trial and error, it looks like it was due to the pip version I was using. I originally used -
pip3 install twilio.
Now I'm unsure of the underlying reason why this did not work, but it seems that pip3 does not encompass all versions of python 3.x? Using
pip3 list and
pip3.8 list
I noticed I had the twilio module for pip3 but not for pip 3.8.
I used the following and was able to solve the issue
pip3.8 install twilio.
I used pip3.8 because that matched the python3.8 version that I am using.
Pycharm user:
Macs (mid 2017) come with python 2.6 and 2.7 installed. PyCharm uses by default 2.6. When you install twilio (Pip install) the module is installed in python version 2.7. So, when you try to run twilio from PyCharm you get
ImportError: No module named twilio.rest
Solution: change the python interpreter in PyCharm. Go to preferences > project interpreter and from the drop menu Project Interpreter choose python 2.7
I think your pip is not configured properly . You may be getting succefuuly installed message but it is not install where it should be. try pip install --user i am sure it will work for you. pip install may work fine only in virtualenvironment without any config.Try pip install --user package name
#iosCurator
I had first installed twilio with the easy_intall tool
I followed the steps below:
Uninstall twilio with the command pip uninstall twillo
Install twilio with the command pip install twilio
Close the python IDLE and relaunch it.
For the windows user,
I have suggested, pip3 install twilio
Follow these steps (on mac):
Shift + Command + P
search: Configure Language Specific Setting
search: Python
add: "code-runner.runInTerminal": true
That's it!
Ask me any question about it by:
My LinkedIn
I ran into this issue when using poetry for my dependency management. Poetry doesn't recognise it as an existing package yet, hence it won't run your code unless you try the poetry+pip way.
there will be 2 reasons for this
1.make sure you kept right path for python files in environment location
2.install twilio
commands:
1.pip3 install twilio
(or)
pip install twilio
2.python otpv.py