I know that this problem has been asked before, and hope that the administrators will not regard this question as a duplicate for it is a bit different. I am using Python 3.6, Windows 10 system with 64 bit. I've successfully installed pip and have used pip to install a bunch of packages (including numpy, matplotlib, mpl_toolkits and so on). But when I install the basemap and run the from mpl_toolkits.basemap install Basemap, an error occurs saying that there is no module named "mpl_toolkits.basemap.
I go to the document of basemap and it says that GEOS of 3.1.1 is required. And when I run the pip install geos, what I get is only geos-0.2.1.
https://i.stack.imgur.com/cuv9Q.jpg
(so inconvenient to upload pictures)
Is their any alternatives to download GEOS for the basemap installation? I know there's a way for Linux to install, but it does not seem to work on Windows.
I encountered similar problem and finally managed installing basemap via Anaconda in my windows7 environment. I have tried following basemap official installation instruction in Unix Shell and pip install xxx.whl methods, and both failed. I think the possible reasons can be some file not compatible with Windows or not up to date.
Basemap installation via Anaconda:
1. Install Anaconda following official instruction.
2. Install basemap using Anaconda Prompt (be sure to use Anaconda Prompt), run conda install -c anaconda-forge basemap. This may prompt anaconda upgrade, accept it. Then anaconda will install the package and the prerequisites, including latest geos, for you automatically.
3. Run with your favorite IDE. I run jupyter notebook from ANACONDA PROMPT, this is important. Since I have two versions of python, and basemap can not be loaded if I initiate jupyter notebook from cmd.
Have to mention that I did install PROJ4 in advance, so I am not sure if Anaconda will install it for you or not if you don't have one. Basemap official installation instruction: https://matplotlib.org/basemap/users/installing.html, you can also find PROJ4 instruction linkage there.
Hope this could help.
Related
I would like to create some graphics with Python that matplotlib seems to be unable to do well, in terms of drawing closed curves on 3D surfaces. A bit of online research led me to mayavi.mlab for that task (Matplotlib: Plot 3D curve on top of 3D surface). I am currently running Python 3.7.11, but I can upgrade to 3.9 or higher if necessary. I have tried multiple ways to install mayavi and all of them fail in one way or another, including the answers to some of the related questions here. Here are my symptoms:
With Anaconda
I tried both conda install mayavi and conda install -c conda-forge mayavi from the command line. Both of them have the same problem, which is being unable to "Solve the environment" with "frozen solve". Then it tries a flexible solve and still fails. Then it tries a different repo and again is unable to solve the environment with frozen solve.
I also tried Anaconda Navigator for the same thing, but it hangs during a step called "Solving package dependencies" for about six hours, at which point I stopped it.
With pip
Another website told me that pip wheels are more reliable for installing mayavi, but that you should pip install vtk first before mayavi. So I did that: pip install vtk and then pip install mayavi. Both seemed to work during install, in the sense that there were no warnings or errors that I could tell. But as soon as I try to import mayavi in a jupyter notebook I get this error:
This looks to my novice eyes like a problem with a Qt interface of some kind, but beyond that I don't know what is going on.
Summary
I'm obviously not an expert at Python but I don't know what else to try. Usually conda seems to be able to figure out package dependencies and install what is needed but not this time. I would be happy for any advice, and I apologize in advance if I have left out some important information. Is the problem due to using the anaconda3 version of python 3.7 but installing mayavi with pip? I would prefer to install mayavi with anaconda anyway so I would appreciate any pointers about how to do that.
Installing VTK itself (not just python pip package of vtk) is also a prerequisite for Mayavi.
(MacOS only:)
The following steps install both VTK and Mayavi:
Prerequisites:
brew install llvm. which requires manual installation steps in brew info llvm.
pip install wheel # optional. I did it before other steps.
Steps:
brew install vtk # very heavy
pip install vtk
pip install mayavi (not needed, but for some reason I needed it)
brew install qt5
brew info qt5 # slow
# Follow instructions of above. (Set PATH plus LDFLAGS and CPPFLAGS for compiler) and close and open the terminal.
qmake # Test qmake works on terminal (to test the PATH of qt5)
pip install pyqt5 # Slow: builds using clang.
export ETS_TOOLKIT=
export QT_API=pyqt5
brew install pyside # (I installed pyside too, at earlier steps. It might be unnecessary)
I did many other things as well but this is the steps to reproduce the effective steps. I hope I haven't missed something that I have done (or if there are unnecessary steps). Since it changes the configs, it is difficult to revert back and test from scratch.
This installs the combination of following versions: vtk#9.1, qt5.
Also clang 13.1.6 .
Which installs both VTK and Mayavi.
Note, I use venv, so the exact pip command may differ for you if you use conda.
Tested on:
Python: 3.9.13, MacOS: 12.4 Monterey M1
I'm using conda with Spyder/Python 3.8.8.
I'm trying to install the geopandas package through conda-install, but when running it, I receive no output.
I've input the command conda install -c conda-forge geopandas and let it run for 30 minutes so far, so I doubt it's just a large package or poor connection. I don't know if I'm supposed to be seeing progress updates, but if I am, I'm not.
Any help is appreciated, thanks!
If you are using the base Anaconda environment, then there are packages that are conflicting with geopandas. I suggest you to create new environment for geopandas:
open anaconda command line and run this command to create new environment:
conda create --name gis python==3.8
You can use any version of python you like of course. Then you need to activate it:
conda activate gis
Now you can install geopandas and jupyter lab if you need it (Personally recommend VSCode):
conda install -y -c conda-forge geopandas jupyterlab
enter code here
Use below command to install,
conda install geopandas
or
pip install geopandas
When using pip to install GeoPandas, you need to make sure that all dependencies are installed correctly.
fiona provides binary wheels with the dependencies included for Mac and Linux, but not for Windows.
pyproj, rtree, and shapely provide binary wheels with dependencies included for Mac, Linux, and Windows.
Windows wheels for shapely, fiona, pyproj and rtree can be found at Christopher Gohlke’s website.
Depending on your platform, you might need to compile and install their C dependencies manually. We refer to the individual packages for more details on installing those. Using conda (see above) avoids the need to compile the dependencies yourself.
This solution might not be exactly relevant, but since there is no marked solution, it might help...
I recently ran into a problem installing geopandas as well. Though I did mine through my terminal and I did receive an error message: OSError: could not find or load spatialindex_c-64.dll.
I used: conda install -c conda-forge rtree=0.9.3.
Check out this post for more info.
As the Anaconda Distribution of Spyder has some typing latency issues on macOS Big Sur, I've gone ahead and downloaded the standalone distribution. However, when trying to install packages with pip I get the error message:
pip install numpy
/Applications/Spyder.app/Contents/MacOS/python: No module named pip
Note: you may need to restart the kernel to use updated packages.
(I know that NumPy is already installed - this just serves as an example). I have Anaconda installed, and there pip works fine. How do I install it for the specific Standalone Distribution?
I solved this problem using the Command Prompt and typing pip install -U spyder. If you don't have the "standalone version" of Python, just install it to have access to this command.
After that, you can simply open Spyder typing in the Command Prompt spyder.
I am new to python and I am having trouble downloading some new libraries that don't appear to be pre-installed. The names of them are rasterio and retrying. I continuously get an invalid syntax error, and I have tried using some different suggestions found online.
pip install rasterio
Above is the way I was attempting to do it, and I also tried without the pip in there, but neither option worked. I am new enough to the language that troubleshooting is very difficult. Any help is greatly appreciated!
There are several ways to install rasterio, using anaconda you have the documentation here: https://anaconda.org/conda-forge/rasterio
If you are on windows installing rasterio using pip install can be difficult since it requires binary wheels, but here is the tutorial: https://rasterio.readthedocs.io/en/latest/installation.html
I advise you to use linux since it is much easier to install packages, you can either install a dual boot or a virtual box.
I suppose you are using Spyder IDE with Anaconda. So, to install rasterio package you can open anaconda prompt and type:
conda install -c conda-forge rasterio
For further information about package installation check out this link.
Also, to install any conda packages just google it once, you will find instructions to install it mostly in anaconda's official site.
Edit:
Please remove the rasterio package once. And install it again, see if works. If it doesn't work create a new environment like: conda create --name myenv. Then install rasterio again.
If this still doesn't work, try to install rasterio from here like conda install -c ioos rasterio.
I have recently installed Anaconda with Python 3.5 and all the rest. I come from R where I am used to install packages dynamically. I am trying to install a module called scitools through jupyter notebook. I would like to recreate this in jupyter. However, I don't know how to dynamically install packages (if it's possible). I would greatly appreciate your help. Thank you!
EDIT: I am trying to use conda as recommended by the community, but it's not working. I am using mac OSX
Check Jake Vander Plus Blog here to learn how to install a package with pip from Jupyter Notebook.
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy
So if you have already done the install with anaconda, you may already have the module installed. In that case in your jupyter notebook after you have activated your kernel, you just need to make sure you execute the import statement.
import scitools
If you haven't installed that module yet, you can install it one of two ways. Both work from your command line or terminal.
pip install scitools
or since you have Anaconda
conda install scitools
and that should do it. Your import statement in your notebook when executed should correctly locate and enable the use of that module.
I had the same issue. It turns out if you open an anaconda window, which in Windows is accessible under the Anaconda drop down, it points to the correct location to install (or update) using pip.