So I am trying to work with Astropy and I definitely downloaded it. However, I am getting an error. I am trying to work in Python 2 rather than Python 3.
The code was just:
import astropy
astropy.test()
This is the error given:
Traceback (most recent call last):
File "/Users/....../Random.py", line 1, in <module>
import astropy
ImportError: No module named astropy
Try a few things at the shell to examine your environment and possibly understand your problem:
which python
which conda
conda list
Basically, the fix was removing Python 3.4, deleting directory, reinstalled 2.7 and Pypm Astropy. Not sure exactly what happened but that was the fix...
Related
I have Python 3.11 and I have done everything expect Anaconda thing in this video below to try and fix this issue.
https://www.youtube.com/watch?v=RvbUqf3Tb1s&t=181s&ab_channel=TechWithTim
Here is the error:
C:\Python311\python.exe
C:\Users\16789\PycharmProjects\cyberNewsfeed\main.py Traceback (most
recent call last): File
"C:\Users\16789\PycharmProjects\cyberNewsfeed\main.py", line 1, in
import feedparser ModuleNotFoundError: No module named 'feedparser'
Attached is a screenshot of my interpeter and structue.
Tried everything in the linked video besides anaconda and i was expecting it to run. I restarted my computer as well.
You have to install the missing package. Try this in a shell inside your python environment.
pip install feedparser
I'm trying to use Cygwin64 to run a python script, but it's not working because for some reason it can't find the module.
Traceback (most recent call last):
File "makeplot.py", line 1, in <module>
import vplanet
ModuleNotFoundError: No module named 'vplanet'
Where are modules installed in Cygwin64 and How do I make sure my module is installed?
It seems you are expecting that Cygwin version of Python should contain any type of module around.
If you look for vplanet, you will find the specific instruction for installation
https://virtualplanetarylaboratory.github.io/vplanet/install.html
python -m pip install vplanet
Have you tried it ?
I'm trying to import PyPDF2 and it won't work. I installed it using pip, then tried it with pip3, it is installed. When I try to import I get the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyPDF2'
I'm using Python 3.7. I found a similar issue here, doesn't seem any of the answers worked and I tried them myself to the same results.
If anyone else runs into this problem try using sys.path to find the site-packages directory. I copied my PyPDF2 packages into my Python37 directory and now it works.
There are similar questions posted on Stackoverflow that did not seem to work for me. I am trying to install the pylab module for Python. I am using OSX. I have Python 2.7, 3.6, and 3.7 installed and have been running IDLE from 3.6. I also installed Anaconda. It looks like I have the modules and libraries I need here:
/Users/[username]/anaconda3/lib/python3.6/site-packages/matplotlib
There is also a pylab.py in that same site-packages directory.
But when I run a simple Python program with:
from pylab import plot, show
I get this error message:
Traceback (most recent call last):
File "/Users/[username]/Desktop/Python/graph.py", line 1, in <module>
from pylab import plot, show
ModuleNotFoundError: No module named 'pylab'
Not sure what I am doing wrong.
This is the error I get when trying to import numpy on opening python (2.7.8):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
This is the path of my python binary /usr/local/bin/python
This is the path of pip /usr/local/bin/pip
Also, when I put in pip freeze I found the numpy package numpy==1.8.0rc1
I have looked at other relevant questions, but I'm not able to diagnose the cause. I'm guessing it might be some problem in PATHS. Where do I start?
As Akshat pointed out in the comments above, I had multiple versions of Python installed. This could have been the effect of using homebrew and/or macports in the past. I followed the steps detailed in Too many pythons on my Mac OS X Mountain Lion
and did a fresh install of Python 2.7.12 I was then able to reinstall pip and the packages subsequently.