Difficulty getting Python 3.3 and numpy to work - python

I'm newer to python, but have seem to screwed things up trying out the new python.
I have an older mac which runs python 2.5 as it's default. I've installed python 3.3. However, when I upgraded numpy my python 2.5 now gives me the:
Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python intepreter from there.
regardless of the directory I run python from. And python 3.3 can't find the numpy module. Did I miss something? How can I get 2.5 running numpy again and get python 3.3 to find the module?
I also can't get virtualenv to work as it gives me the error that the script needs python2.6, even after I installed virtualenv-2.5 and can't get the python=python3.3 to do anything either. I seem to have tried everything I can find. I'm afraid I've installed too much and have some hidden conflict.
Thanks

download numpy from this site : http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
In case you want to check the version of numpy on your system , write this following code on your IDE :
import numpy
numpy.version.version
Hope this would help !

Related

Import Error when using VSCode with conda interpreter but not when importing in Conda

I'm trying to run a Python program in VSCode and it always stops in the first line
from sklearn.gaussian_process.kernels import WhiteKernel, RationalQuadratic, RBF, Matern, ExpSineSquared
The error it gives me is pretty big, I'll paste it at the end.
However, when when I open python in my conda terminal, I can import with no issues at all. Since I'm using the conda interpreter in VSCode, I don't understand what the issue is.
My Python version is 3.7.6, numpy 1.19.1, scipy 1.5.2, sklearn 0.23.2 and am working with Windows 10. I have already tried what the webpage mentioned suggested. And on the bottom left of VSCode it says that the interpreter is Python 3.7.6 64-bit ('base':conda).
Just tried, and I can't import numpy either, but can in conda with no problems. The python versions are the same. EDIT: The error message here asks me to be sure that the Numpy version is 1.18.1, instead of 1.19.1.
Exception has occurred: ImportError
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
The Python version is: Python3.7 from "C:\Users\jdion\anaconda3\python.exe"
The NumPy version is: "1.19.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed: The specified module could not be found.
File "C:\Users\jdion\OneDrive\Ambiente de Trabalho\Tese\Code\The Sea Exploration Problem _aux.py", line 13, in
from sklearn.gaussian_process.kernels import WhiteKernel, RationalQuadratic, RBF, Matern, ExpSineSquared
I uninstalled both conda and all my Python versions and when I reinstalled Python 3.7.9 and selected it as the interpreter in VSCode there were no more issues. I think the problem was having too many Python versions, anaconda, pip, and I was probably installing and removing things in the wrong places.

Numpy installed, but module not found

I've tried several fixes for this suggested in other threads, but no luck.
I'm new to Python. I had 3.8.5 installed and wrote a few simple scripts that worked using PyCharm and the numpy and sympy modules. Today I opened PyCharm and tried to write a simple script using numpy, but I got an error saying the numpy module did not exist. I also got this error when trying to run the older scripts. I checked in cmd with pip3, and got the result that it was already satisfied. I uninstalled Python, numpy, and PyCharm, reinstalled all and I'm having the same problem. This problem seemed to crop up on its own - I don't recall making any changes that would've caused this.
Can anyone give me other options?
One of the most common issues with Python is having multiple versions installed and losing track of which one you are using and/or which one you're installing to with pip.
In Pycharm check what interpreter your project is using. If there is more than one available chance are you installed numpy on the other one.
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#add-existing-interpreter
You can also install numpy direct from Pycharm, simply hover over the import statement and if it's not installed on the current interpreter it will offer you a link to click in install it.
If that doesn't help, post the exact error message and your code.

importing h5py for python Python 2.7.3

I have ARCGIS 10.2 . When we install this software, python 2.7.3 (on win32) is also installed which we can develop the software by python and by arcpy module. I want to add h5py to it's library. My windows is 64 bit and I downloaded both hy5py 32 and 64 bit and copied them to the Lib folder. When I open IDLE an try to import it, I encounter with the following error:
"ValueError: numpy.dtype has the wrong size, try recompiling".
I also copied six. and I think the problem is with numpy. I replaced the numpy from anaconda(numpy 1.9) with numpy in ARCGIS python Library. Then I could import h5py but I could not open arcpy.
I really appreciate for your help
It sounds like the NumPy that came with your system was built one way, with one version, then you "installed" (by copying) h5py which was built another way, either with a different version or different options for NumPy.
To fix this, you should try building h5py yourself, which you can do by downloading the Source from here: https://pypi.python.org/pypi/h5py/2.5.0
Or perhaps easier, consider using Pandas. It can also read and write hdf5 files (though perhaps with fewer arcane features), and it's quite likely that someone has already provided a package for Pandas which is compatible with your existing installation.

cannot import numpy in idle (2.7) after anaconda installation

I've installed numpy from the following link http://www.scipy.org/install.html
After installation the paths are defined (verified with which -a python)
/Users/user_name/Documents/anaconda/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/bin/python
/usr/local/bin/python
when open idle 2.7 and try to import numpy I get the following error message
ImportError: No module named numpy
any ideas what to do?
So you have several python installations going; which one is idle using?
This should get you pointed in the correct direction for finding modules:
http://docs.python.org/release/2.7.5/tutorial/modules.html#the-module-search-path
(Tweak the version number in that URL as appropriate.)
If that doesn't help, then the list of Related questions, to the right, currently has this as the first hit, and it looks useful too.

python newbie: importing numpy module in eclipse

I'm trying to run a simple python program in eclipse. This is the first time that I'm importting any module.
So I downloaded: numpy and pylab (I'm using a mac) restarted my eclipse and the red line below the
import numpy
import pylab
disappeared so I understood that the reference to that module is ok.
Problem is that I still see red line below the code and wonder why? I have to stress out that I believe numpy was already 'pre-installed' I just upgraded the version (using 1.5.1-py2.7).
Can anyone tell what should I do to run this code?
my interpreter setting on eclipse:
If you are using PyDev, you should first have to go to Preferences, then Pydev, then Interpreter Python and then Libraries to add NumPy.
Else, verify that you have NumPy installed, from the interpreter, just call from numpy import *
Edit:
Also check you already have Matplotlib installed, the error you are getting on the console points to that being the cause, you can download Matplotlib here.
I recently installed Anaconda3 and just started learning how to use Pandas and I wanted to be able to work with Pandas in Eclipse as well.
I first tried adding a reference to the site-libraries at:
C:\Anaconda3\Lib\site-packages
And it seemed to work by allowing me to import numpy and pandas. However, since I had just used conda to update everything, my Python34 interpreter seemed to fail when I tried running some code and numpy was looking for my Python35 installation. For some reason this was located at:
C:\Users\myname\AppData\Local\Programs\Python\Python35-32
However, Anacondas installed another version somewhere else. By going into:
Windows > Preferences > PyDev > Interpreters > Python Interpreter
and clicking on Quick Auto-Config it found my Anacondas version of Python35 and then I just had to figure out how to make my current project use the Python35 interpreter.
Hint: To do this, you need to go into the Project properties by opening the project and choosing File > Properties or right-click the project to choose Properties.
Simply removed the old numpy and installed version 6. located here
Another way to circumvent this problem is to use pip install numpy check how to install pip

Categories

Resources