Link conda HDF4 to conda GDAL (Anaconda Python) - python

I have python installed through the Anaconda distribution. It works for most regular things. I need to be able to open a MODIS HDF4-EOS file, however. I have tried
conda install -c https://conda.binstar.org/mutirri hdf4
conda install gdal
python -c "from osgeo import gdal; ds=gdal.Open("MOD021KM.A2014005.0910.006.2014005194151.hdf"); print type(ds)"
But I get
ERROR 4: `MOD021KM.A2014005.0910.006.2014005194151.hdf' not recognised as a supported file format.
< type 'NoneType' >
hey... It seemed viable.
Does anyone know how to open an HDF4 file using Anaconda distribution of python 2.7 using GDAL?
I would greatly appreciate your help in doing so.
Thank you all.

While your question is not the same as this one https://gis.stackexchange.com/questions/110662/install-gdal-in-centos-without-root you should be able to use the method given in the accepted answer:
conda update conda
conda update anaconda
conda install -c https://conda.binstar.org/jgomezdans gdal=1.11.0
This version of GDAL from binstar is build with HDF4 support and will automatically install the conda HDF4 package. Best remove the existing GDAL and HDF4 packages you have already installed prior to getting the new ones.

Related

python library install Questions

I use Python and pycharm as a tool.
If you use the pip statement to install the library, you will get an error.
For example, if I want to download the torch (1.6.0) version and type pip install torch==1.6.0,
It says no version.
This is not the end, but some libraries continue to cause strange conflicts and will not be installed.
For example, if you type pip install poro to install the poro library, an unknown error pops up and the installation fails.
I'm not asking for a pororo installation.
My question is, I want to know how to download the library without relying on pycharm.
I want to download it separately from a site like pypi and put the library directly into the virtual environment (conda).
What should I do?
The following worked for me:
First, install mkl using conda:
conda install -c anaconda mkl
Then run this:
conda install -c pytorch pytorch

Conda install geopandas doing nothing

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.

Trying to install new libraries on Spyder (Python 3.7)

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.

How to install gensim on windows

Not able to install gensim on windows.Please help me I need to gensim Immediately and tell me installation steps with More details and other software that needs to be installed before it. thanks
First you need to install NumPy then SciPy and then Gensim (assuming you already have Python installed). I used Python 3.4 as I find it easier to install SciPy using version 3.4.
Step 1) Install Numpy:
Download numpy‑1.13.1+mkl‑cp34‑cp34m‑win32.whl from here
note that in cp34-cp34m 34 is version of Python you are using. So download appropriate file
Open command prompt and go the folder in which you just downloaded the file and install Numpy using following command:
pip install numpy‑1.13.1+mkl‑cp34‑cp34m‑win32.whl
You should get successfully installed numpy message
Step 2) Install SciPy:
Follow the same link as above and download the scipy‑0.19.1‑cp34‑cp34m‑win32.whl file.
Install it using the same instructions than in Step 1 but with this file name. The command is the following:
pip install scipy‑0.19.1‑cp34‑cp34m‑win32.whl
You should get this message successfully installed scipy
Step 3) Install gensim:
Follow the link in step 1 and download gensim‑2.3.0‑cp34‑cp34m‑win32.whl (the appropriate version for your system)
Install it using the instructions in Step 1 (with this file name) with following command:
pip install gensim‑2.3.0‑cp34‑cp34m‑win32.whl
You should get this message successfully installed gensim
Now in a Python shell try:
import gensim
It should be successfully imported
NOTES:
Make sure pip is in your environment variables (add C:\python34\scripts to your environment variable).
Make sure to download all the packages according to the Python version you are using.
gensim depends on scipy and numpy.You must have them installed prior to installing gensim. Simple way to install gensim in windows is, open cmd and type
pip install -U gensim
Or download gensim for windows from
https://pypi.python.org/pypi/gensim
then run
python setup.py test
python setup.py install
I struggled with this a bit today trying to figure out if I needed a python 2.7 environment or if I could use my 3.5. I ended up doing this from an Anaconda 3.5 install:
conda install -c anaconda gensim=0.12.4
After a few hours of trying various things, suddenly it all worked on 3.5. My error was that it kept failing to install Scipy. I tried starting over with the conda install and just worked.
See: https://anaconda.org/anaconda/gensim
I strongly suggest using anaconda where the installation of all the packages is very easy.
The command for installing genism and all of its necessary packages on windows using anaconda python 3.7 is below.
conda install -c anaconda gensim
I followed the instruction on https://radimrehurek.com/gensim/install.html which then successfully installed the fast version of Gensim (3.8.0) on Windows:
conda install -c conda-forge gensim
PS:
The following did NOT install the fast version on Windows:
conda install gensim
After attempting some of the above ideas, there was still a "hiccup" with gensim but the error was something else related to punkt. The following (where the interest is the second line)...
import nltk
nltk.download('punkt')
import numpy
import scipy
import gensim
...did the trick. I used conda and not pip but do not believe that mattered.
Versions: latest python
Machine: Windows 10 (latest updates as of 8/2020)

anaconda and point cloud library

Can you tell me how can I configure point cloud library to be used with anaconda, I have never used point cloud before. I have installed pcl1.6.0 all in one installer, openNI and PrimeSense. But even after this when I run my python code in anaconda it gives me the error:
ImportError: No module named pcl
Do I need to copy my pcl1.6.0 folder in the site-package folder if anaconda?
the code is here:
import pcl
p = pcl.PointCloud()
p.from_file("C:\Users\Kangkan\Desktop\ikea.png")
fil = p.make_statistical_outlier_filter()
fil.set_mean_k (50)
fil.set_std_dev_mul_thresh (1.0)
fil.filter().to_file("inliers.pcd")
You can try this:
conda install -c sirokujira python-pcl --channel conda-forge
Found solution on this website [https://anaconda.org/sirokujira/python-pcl] yesterday.
I am using Python 3.6 in Anaconda3 for Windows10(64).Hope this would be useful for you.
You could try:
conda install -c https://conda.anaconda.org/ccordoba12 python-pcl
This references wasn't available when you asked the question, but using it worked for me! https://anaconda.org/ccordoba12/python-pcl.
I am using windows and ran the conda install line with cygwin.

Categories

Resources