Anaconda Spyder is supposed to include numpy, scipy etc with the installation. Someone has installed Spyder for me on Windows 7 but if I try to import numpy or scipy , I get this error:
import numpy as np
ImportError: No module named numpy
I also can't run "conda" on the console.
What's wrong? What should I do to fix this? I tried adding PYTHONPATH in environment variables but no difference.
How can I check if they're even installed? I searched for NumPy in the computer, I only found the following:
It sounds like someone installed just spyder, not Anaconda, which is a separate thing (Anaconda is a collection of several Python packages, including Spyder, NumPy, and SciPy). Try downloading and installing Anaconda and using the Spyder that comes with that.
The thing is you have to install python 2.7. Surely you have a different python installed. If you download and install Python 2.7 this should works. Other thing you can do is search for the Anaconda Spyder version that support the Python you have installed.
It's probably that your the python core version of your spyder environment is different from the conda python version.
Python core version of your spyder environment
Conda python version
So you should make them of the same version then the problem will be solved.
Related
I have an odd problem. I Installed Python 2,7 and afterwards installed Anaconda. If I use the terminal and type "python" followed by "import numpy" I everything is fine, no error.
However if I try to import numpy in the IDLE I get this:
"ImportError: No module named numpy"
Why is this? I thought the numpy was installed on the computer once and for all when I installed Anaconda.
When u install Anaconda it installs Python and other packages and might add Python to the PATH. Hence when you type python it opens anaconda's interpreter which has necessary packages. But you are opening IDLE of your previous python interpreter which doesn't have numpy.
I have install PyautoGui without any errors on my Windows 7 machine. When I am importing pyautogui, it is giving me "ImportError: No module named 'pyautogui'" error. I am using Python 3.6.0a1 shell.
I am a new bee at python, so your help will be much appreciated.
I have other versions of python before which I uninstalled and then reinstalled 3.6. Their folders are still in C drive. Thank you.
Look into Tim Reilly's blog.
You have a couple of environments which means you may not have pyautogui installed in Python 3.6.
Virtual environments mitigate this because you can run multiple versions of Python with different packages installed. Once you have an environment setup,
mkvirtualenv environmentName
workon environmentName
you can install a given package and ensure that you have a relatively standardized setup.
Alternatively, use something like pip install to make sure you have installed (or reinstall) this in your current python environment.
I recently installed Anaconda on Arch Linux from the Arch repositories. By default, it was set to Python3, whereas I would like to use Python2.7. I followed the Anaconda documentation to create a new Python2 environment. Upon running my Python script which uses Numpy, I got the error No module named NumPy. I found this rather strange, as one of the major points of using Anaconda is easy installation of the NumPy/SciPy stack...
Nevertheless, I ran conda install numpy and it installed. Now, I still cannot import numpy, but when I run conda install numpy it says it is already installed. What gives?
Output of which conda: /opt/anaconda/envs/python2/bin/conda
Output of which python: /opt/anaconda/envs/python2/bin/python
The anaconda package in the AUR is broken. If anyone encounters this, simply install anaconda from their website. The AUR attempts to do a system-wide install, which gets rather screwy with the path.
I have keras installed on my linux machine, but when I try to import a dataset from the keras.datasets I get an error that it cannot find it.
So for example:
from keras.datasets import mnist
I get the error
ImportError: No module named keras.datasets
I installed keras using pip install and it installed successfully.
Indeed the problem was that I had multiple versions of Python.
Removing Anaconda Python and installing all libraries using pip / apt-get instead of conda solved my problem.
I found this to be true but it is not necessary to delete anaconda.
I had the same issue but with multiple python versions. However, i created an environment that only used the Anaconda version (while in that environment). In terminal (on mac and other suitable terminals), type/copy
conda create -n dataweekends python=2.7 pandas scikit-learn jupyter matplotlib
dataweekends is simply the name of the environment you created. To access this, just use the command
source activate dataweekends
Be mindful that you might (probably) have to reinstall dependencies once in that new environment.
I got this trick from here "https://www.dataweekends.com/blog/2017/03/09/set-up-your-mac-for-deep-learning-with-python-keras-and-tensorflow"
I would also recommend setting up different environments for each project you do in python.
Do you have keras.py or keras.pyc in the current working directory? If so, this will mess up the imports. Try renaming the file and/or deleting keras.pyc.
Thanks to the comment from Selcuk which got me on the right track.
Indeed the problem was that I had multiple versions of Python.
I followed some online instructions to installing Keras which recommended installing MiniConda/Conda/Anaconda which is its own version of python. So I had two Python2.7 versions installed:
Normal Linux Python 2.7
Anaconda Python 2.7
Removing Anaconda Python and installing all libraries using pip / apt-get instead of conda solved my problem.
I can't seem to install numpy to PyCharm.
I started with an up-to-date, fresh install of Python 2.7.8 and PyCharm 3.4.1.
Then I installed winpython in PyCharm to get the numpy and scipy packages using
File > Default Settings > Project Interpreter > selected Python 2.7.7 > installing pip and setuptools > installing winpython...
After installing these, I went to run a simple code using numpy and continue to get an error of "no module named numpy". My professor did the exact same thing and his works fine (both using Windows 7).
Go to the Winpython website, download the version according to your needs and install it locally. Then open PyCharm and add a new python interpreter giving the path of where you installed Winpython to (the python-... subirectory).
Winpython is a Python distribution, it provides a python environment with packages like Numpy or Scipy precompiled and preinstalled. It's not a package itself (there is one, but this is not the entire distribution!).