Installing RTree and geopandas in windows 10 64 bit OS - python

I tried installing geopandas in python 3.6 with no error but when I import the module in python I got this error.
could not find or load spatialindex_c.dll
The same thing happens to RTree, displaying also the same error, but has installed correctly using the following commands:
For geopandas:
pip install geopandas-0.4.0-py2.py3-none-any.whl
For RTree:
pip install Rtree-0.8.3-cp36-cp36m-win_amd64.whl
What could be the problems with these?
The following libraries have already been installed and are working: gdal, fiona, scipy, missingno, shapely, pysal, numpy, pandas and matplotlib.

Related

Python: why do I get an error when I call osgeo on mac?

I try to import ogr from osgeo
from osgeo import ogr
but I get the following error
ModuleNotFoundError: No module named 'osgeo'
Before I installed GDAL, if I do:
pip3 install gdal
Requirement already satisfied: gdal in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2.4.1)
which pip
/anaconda3/bin/pip
which python
/anaconda3/bin/python
It will likely do with relative and absolute imports, provided you installed the package correctly. Either doing a simple module name alteration or changing where/how you import should fix this. A detailed explanation is in the top 2 answers to the question linked below.
Relative imports - ModuleNotFoundError: No module named x
The issue that you are facing is mainly because you are installing the packages with pip3 and it is stored to the site-packages in the native python3.
You are running the code with the python which came with anaconda. The simplest way to solve this is to install gdal with conda.
conda install -c conda-forge gdal

error importing numpy in python 3.5

I tried installing numpy with homebrew, but instead it installed in the Python 2.7 version. I found this out by following the answer on this post: Can't import numpy
Which is very strange especially since I specifically asked for python3:
M$ brew install numpy --with-python3
Warning: homebrew/python/numpy-1.11.1 already installed
However, when I try importing it in Python 3.5 I always get the same error:
File "Dataframe.py", line 1, in <module>
import numpy as np
ImportError: No module named 'numpy'
How can I get it to work as intended? I am on mac os 10.11.3
Check that you have Python 3.5 installed by running which python3 and which python (to make sure your versions aren't mixed up).
Then, to install for Python 3, you should run pip3 install numpy. It's a good idea to use the given Python tools to install Python-related packages.

Importing opencv and getting numpy.core.multiarray failed to import

Trying to install OpenCV and running into an issue where attempting to import cv2 results in this output -
RuntimeError: module compiled against API version 9 but this version of numpy is 7
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import cv2
ImportError: numpy.core.multiarray failed to import
I'm running on Windows 7 x64, Python v 2.7.9
Thanks!
The error is telling you that you have an out of date version of numpy. If you used pip to install things you can simply run pip install numpy -U, or download the appropriate version from their website.
In case
pip install -U numpy
doesn't work (even with sudo), you may want to make sure you're using the right version of numpy. I had the same "numpy.core.multiarray failed to import" issue, but it was because I had 1.6 installed for the version of Python I was using, even though I kept installing 1.8 and assumed it was installing in the right directory.
I found the bad numpy version by using the following command in my Mac terminal:
python -c "import numpy;print numpy.version;print numpy.file";
This command gave me the version and location of numpy that I was using (turned out it was 1.6.2). I went to this location and manually replaced it with the numpy folder for 1.8, which resolved my "numpy.core.multiarray failed to import" issue. Hopefully someone finds this useful!
I had a similar problem and I solved it by downgrading my numpy version.
What I did was:
pip install opencv-python
pip uninstall numpy
pip install numpy=1.18
This has worked for me using
Python 3.7
opencv-python 4.4.0.46
numpy 1.18.0
linux: sudo apt-get install python-numpy
if you are using ubuntu bionic beaver then try running: sudo apt-get install python-numpy
had the same issue, resolve by running the above command.
Hope it helps
In your environment you can try this command:
conda uninstall numpy
conda install -c conda-forge numpy
I use Python 3.7 # RPI 4.
For opencv to install properly I had to install the listed libraries below.
(Not every package was actually installed, after request)
Regarding Numpy, I think one should stick to the latest version.
For me what worked is to uninstall the existing version 1.16.2 and stick with the current stable 1.21.2.
Stackoverflow topic at missing libraries here: ImportError: libcblas.so.3: cannot open shared object file: No such file or directory.

Pip and Python not aligning

I'm on OS X 10.7.5
I am trying to get matplotlib to work on my machine, so I did pip uninstall matplotlib and then tried pip install matplotlib, but it said my NumPy version was out of date -- 1.5, and I needed 1.6.
OK, so I did port install py27-numpy and that seemed to work. But I was still getting the same complaint when I tried to install matplotlib.
Now here's the strange thing. When I do:
import numpy
numpy.version.version
I get 1.5.1. But when I do
import pip
pip.get_installed_distributions()
I see numpy 1.8.0 and matplotlib 1.3.1. Why is my NumPy 1.5.1 in some places, and 1.8.0 in others, and how can I reconcile the two to 1.8.0 so I can install matplotlib correctly?

ImportError: matplotlib requires dateutil; import matplotlib.pyplot as plt

Am new to progamming and Python, i keep getting the error below when i run my program. Someone advised i should use pip to solve it. But cant pip get installed using the cmd. Though i suceeded using Powershell but still cant make it work. How do i solve this, any tips will go along way. Thanks
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from satmc import satmc
File "C:\Python27\starb_models_grid1\satmc.py", line 3, in <module>
import matplotlib.pyplot as plt
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 110, in <module>
raise ImportError("matplotlib requires dateutil")
ImportError: matplotlib requires dateutil
Am using version 2.7.3
You need to install various packages to get numpy working correctly.
libsvm-3.17.win32-py2.7
pyparsing-2.0.1.win32-py2.7
python-dateutil-2.2.win32-py2.7
pytz-2013.9.win32-py2.7
six-1.5.2.win32-py2.7
scipy-0.13.3.win32-py2.7
numpy-MKL-1.8.0.win32-py2.7
Matplotlib
Download all the binaries from this link and install and then you will have a working numpy installation.
You're probably looking for:
pip install python-dateutil
The error states that you are missing Dateutil.
This could mean that you did not install Dateutil with pip install python-dateutil or your way to install Python modules. But if you did your pip install and still get the same error it could also mean that DateUtil is installed in a folder where your Python distribution does not expect it.
In my case (Mac OSX) I installed pip with Brew http://brew.sh/. That pip will install the modules in: /usr/local/lib/python2.7/site-packages/
However the standard Mac OSX Python distribution will look for modules in /Library/Python/2.7/site-packages/
Your folders could be different of course, but you can check where Python looks for modules with:
import sys
print sys.path
Check this and see if one of the directories in the list contains the directory where dateutil is installed.
If not add a PYTHONPATH environment variable: Like: PYTHONPATH=/usr/local/lib/python2.7/site-packages/ or the folder where your dateutil is installed
I did pip install python-dateutil, but kept getting the same error. I got past that error by installing from http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-dateutil
Look for the Matplotlib section and install the dependencies you don't have.
Matplotlib is a 2D plotting library.
Requires numpy, dateutil, pytz, pyparsing, six, setuptools, and optionally pillow, pycairo, tornado, wxpython, pyside, pyqt4, ghostscript, miktex, ffmpeg, mencoder, avconv, or imagemagick.

Categories

Resources