Problems with numpy in PyCharm - python

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!).

Related

How to get python packages installed for 32 bit before but works on 64bit as well in Visual Code? E.g. Pytorch

I use
(1) Windows 11,
(2) Python 3.7.8 for 64bit ;
Python 3.8.3 for 32bit
(3) Visual Studio Code.
I noticed that all my python packages are installed on 32Bit, is there any way to get my packages works on 64bit as well? Because I wish to use Pytorch, however, it only works on 64bit
I tried to install packages again, but it installed for my 32 bit? So it cannot install again?
I checked my system path but I have no idea how to do with path for my packages?
I also installed PyTorch in Visual code, but it does not appear installed in my python environment...Why?
I tried to install PyTorch by pip and it gives me error as below:
Updates: ------------------------------------------------
I tried: Ctrl+Shift+P, select that 64bit python
Then, in the terminal I tried to install packages, it still shows that my package is already installed...
You have selected Python3.7.8(64) in the jupyter notebook, while you have installed the python modules in the Python3.8.3(32) environment. So it will prompt No module named 'pandas'.
And looks like torch has no 32bit version, if you want to use it, you need to select Python3.7.8(64).
So, you can activate the terminal first through open a python file and then clicking the python interpreter on the bottom-right of the VSCode or choosing Python: Select Python interpreter in the command palette directly.
Then take the shortcut of Ctrl+Shift+` to create a new terminal with the activated python environment. After this, you can install the modules in the right place.
You can refer to the official docs for more detail.

Installing matplotlib for Python 3.5 on mac for dummies

How do I download and install matplotlib for Python 3.5 for my mac to use in Eclipse? My mac is running macOS High Sierra version 10.13.1. I can handle quantum mechanics and thermodynamics, but the whole downloading and installing and using new python programs/packages/libraries/stuff is so hopelessly confusing to me. Assume I don't know anything, because I don't.
For scientific work using Python I recommend using Anaconda. It has all relevant packages installed.
Follow these steps:
Download Anaconda
Double Click the File in your Download Folder
For further setup with Eclipse, follow these steps.
Given that you have Python3 already installed you could also try:
python3 -m pip install matplotlib
In my experience, it is wise to consider installing a package manager like Anaconda. For something like matplotlib however, using
pip install matplotlib should be more than sufficient. For your information, the Mac already has pip (a package management system) installed, so running the above command should be enough.

Installing SciPy for Python 3.7 on Mac Os High Sierra

please help installing SciPy. I think i've tried almost any advice i could find, but still no luck.
I am using Mac High OS Sierra 10.13.1, python 3.7, trying to make this work for IntellIJ IDEA 2017.2 IDE. I have Xcode version 9.2 if that helps.
I've tried instaling from IDE, using package installer -> fails with error status code 1.
I've tried installing using pip3 install scipy
I've installed brew install gcc ( I have version 7.2.0 installed)
I've installed numpy.
I've tried to install using Macports as suggested on official site - didn't help.
I've tried to instal using brew install scipy.
I've tried to install using Conda. It installed somewhere to Conda Dir, but i still cannot access library from python file using import scipy, error: No module named scipy.
Looks like i am just going in loops now, can some one suggest any idea please?
Topics i researched:
SciPy build/install Mac Osx
Can't install Scipy through pip
"failed with error code 1" while installing scipy
Some other ones i lost links to.
Ok looks like i made it work.
This thread: helped me.
It appeared I was actaully able to install scipy package using conda. But my Python didn't see the package. So i had to:
Change Right Click on my project in IDE > Project > New > Python SDK > Add Local
Select Python in Conda dir. In my case it was /Users/[my user ]/miniconda3/bin/python3.6
Restart IDE just in case and my python script was able to see import scipy.
The downside of this - that I cannot install packages the clean way from IDE anymore for some reason. I.e. Tools > Manage Python Packages > + > doesn't find any. And I have to reinstall all the packages i had using conda install [package name] from terminal . But I am fine with it, as long as it works.
Hopefully my quest might be useful for someone.

Python Anaconda - no module named numpy

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.

ImportError: No module named ... after spyder install

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.

Categories