I am new to python and anaconda.
I am using Python 3.5.1 |Anaconda 4.1.0 (64-bit)| (default, Jun 15 2016, 15:29:36) [MSC v.1900 64 bit (AMD64)]. The version of the notebook server is 4.2.1.
When I issue the following command
import tweepy
it runs successfully.
But when I try to run the following command
%%file test.py
import tweepy
Its getting save as test.py
When I issue the following command
!python test.py
I am getting the following error.
Traceback (most recent call last):
File "test.py", line 2, in <module>
import tweepy
ImportError: No module named tweepy
I am able to see tweepy folders in my anaconda installation directory
D:\Anaconda3\Lib\site-packages
tweepy-3.5.0.dist-info
tweepy
Where am I going wrong. Kindly guide me.
Thanks.
Since I have multiple versions of python installed on my machine this issue exists. So when I point to the correct directory of my python installation, its working fine.
Related
Python noob here. I've been trying to install pygame and pandas for a few hours now. Even with Conda I did not succeed. I have Python 3.8.5 installed.
I eventually tried through the terminal with these commands:
python -m pip install pygame==2.0.0.dev6
and
python -m pip install pandas
(this was a total guess by the way, but apparently it did something)
Results were succesfull:
Requirement already satisfied: pygame==2.0.0.dev6 in /opt/miniconda3/lib/python3.8/site-packages (2.0.0.dev6)
and
Successfully installed numpy-1.19.2 pandas-1.1.2 python-dateutil-2.8.1 pytz-2020.1
But, when I try to import either modules, I still get errors. Any ideas?
import pygame
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
import pandas
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
Do I need to move the modules to the script folder or something? Or what do I even move? Thanks!
Ok.. Got it thanks to #matt.. after succesfully installing pygame, find the environment in which pygame is installed by entering 'which python'.
In my case it returned:
/opt/miniconda3/bin/python
Now I needed to make sure the VS console was pointing at the same environment, by checking which python interpreter it was using and selecting the correct one. More info:
how to check and change environment in VS Code
I have installed python 38 on my PC (Windows 10 Pro, 64 bit). It is in the following directory;
C:\Users\rschafish\AppData\Local\Programs\Python\Python38-32
I then downloaded nltk-3.5 (the download is a zip file obtained irectly from the nltk website) and I unzipped it and placed the files in the python Lib directory.
C:\Users\rschafish\AppData\Local\Programs\Python\Python38-32\Lib\nltk-3.5
I opened python using IDLE (Python 3.8.3 Shell) and the opening line from python includes;
(Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020 22:20:19 MSC vl1925 32 bit Intel on win32)
I then entered >>> import nltk and received the following error message;
Traceback (most recent call last): File”<pyshell#0>”, line 1 in import nltk
ModuleNotFoundError: no module named ’nltk’
It appears that this may be a problem related to the python path however I thought that placing the nltk files in the python Lib directory is what should be done. I have searched the issue online but did not find any solutions that have worked for me.
Help and advice will be greatly appreciated.
I'm running Raspbian Stretch, everything is up to date. I'm using visual studio code and writing Python. I'm try to run a simple piece of code in a tutorial:
from datetime import date
print(date.today())
I get an error message saying:
/usr/bin/python3 /home/pi/Python/datetime.py
Traceback (most recent call last):
File "/home/pi/Python/datetime.py", line 1, in <module>
from datetime import date
File "/home/pi/Python/datetime.py", line 1, in <module>
from datetime import date
ImportError: cannot import name 'date'
The interpreter is using Python 3.5.3 32-bit. If I switch the interpreter to Python 2.7, it works. If I run those two lines of code in a terminal using python or python 3, both work. It is just this one interpreter in VS code. I uninstalled and reinstalled python 3.5. What am I missing?
Hi I have been trying to install twython for Jupyter Notebook. I have proved through the python repl that it is universally installed throughout my laptop. But it still won't appear on Jupyter Notebook. Looking for help trying to figure out it is found in a spot that it can be found by my Anaconda 3 Jupyter Notebook.
Context: Homework assignment trying to mine twitter for tweets
Here is the errors I am receiving and I am running Mac OS
/Users/name/twitter/__init__.py:22: UserWarning: The twython library has not been installed. Some functionality from the twitter package will not be available.
"The twython library has not been installed. "
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-38297a1141e0> in <module>
----> 1 import twitter
2 import twython
3 #---------------------------------------------
4 # Define a Function to Login Twitter API
5 def oauth_login():
~/twitter/__init__.py in <module>
34
35
---> 36 from nltk.twitter.common import json2csv
ModuleNotFoundError: No module named 'nltk.twitter
Have you installed nltk package?
If not, do it:
pip3 install -U nltk
then run python3
inside python3 command line, run:
import nltk
nltk.download()
after the download, restart jupyter, and run your code again.
This question has been asked a few times, but the remedy appears to complicated enough that I'm still searching for a user specific solution.
I recently installed Quandl module using pip command. Even after successful installation my python idle is still showing
Traceback (most recent call last):
File "F:\Python36\Machine Learning\01.py", line 3, in <module>
import Quandl
ModuleNotFoundError: No module named 'Quandl'
I have used import command in my code.
I am using python 3.6.1 version.
I am working on a windows 10 Desktop.
I have also tried re-installation of module.
You can better navigate to your python scripts folder and open a command window there and try pip3 install quandl .Hope this helps.