Import raster files into Python 3.10 - python

I'm working on a project that requires the python 3.10 version but am having some difficulty accessing the files on that version. These files have the '.tiff' extension and contain metadata information about multispectral bands like resolution, band number, etc. I was able to import the files using the rasterio module in 3.9 version but couldn't get it to work on 3.10 and couldn't find another module perform the task. I would appreciate any advice on this, thanks.

As of today, doing pip install raster will attempt to install rasterio-1.2.10, which supports Python 3.6 to 3.9. For Python 3.10 support, you'll need to rasterio 1.3, which is currently in beta. You can install 1.3 beta 3 with pip install rasterio==1.3b3.

Try using : pip install whatever_you_want
In the shell. It resets the package and it should work.
like: if you want to install ‘Replit’ just do pip install replit in the command shell

Related

How to install matlabengine (Windows 10, MATLAB R2020b, Python 3.8.10)

I have the following environment:
Windows 10
Python 3.8.10
MATLAB R2020b
I'm trying to install matlabengine (pip install matlabengine) package, and I'm getting the following error:
RuntimeError: No compatible MATLAB installation found in Windows Registry. This release of MATLAB Engine API for Python is compatible with version 9.13. The found versions were 9.9
What am I missing ? (according to https://pypi.org/project/matlabengine/) it seems I'm using the right versions.
How can I check the versions I have (9.9 or 9.13 because as I wrote above I have MATLAB R2020b and Python 3.8.10).
The error is about the MATLAB version, not the version of matlabengine (the Python module).
You wrote that you have MATLAB 2020b. That is the release name for MATLAB version 9.9, as can be seen in this table on Wikipedia.
As can be read on the description of matlabengine 9.13.1, this engine version requires MATLAB release R2022b (= 9.13).
To use matlabengine with MATLAB 2020b, install version 9.9.1:
python -m pip install matlabengine==9.9.1
You need to try all versions of MATLAB engine starting from the latest one going backwards. What worked for me on Ubuntu was
$ python -m pip install matlabengine==9.12.17
NB: To get a list of all the possible versions, try install one that doesn't exist e.g.
$ python -m pip install matlabengine==9.9.2
and it will give you an error with the list of possible versions.
You can try to install specific version of matlabengine.
pip install matlabengine==9.13.1
If they cannot find your version, you might need to update pip.
Also, you can check your current matlabengine version.
pip show matlabengine

No module found error for a downloaded package (sksparse.cholmod) and how to download a package from the internet to conda

I need to use the sksparse.chomod package however my pycharm does not let me install it as it can't seem to find it.
I found the sksparse package on github and downloaded it but I do not know how to add a package downloaded from the internet into a conda environment. So, my first question would be can you download a package from github and add it to your conda environment, and how do you do this?
As I did not know how to do the above I instead saved the package within my project and thought I could simply import sksparse.cholmod. However, the line in my code that says import sksparse.cholmod as sks has no errors with it, so I assumed that meant this was ok, but when I try to run my file I get this error:
import sksparse.cholmod as sks
ModuleNotFoundError: No module named 'sksparse.cholmod'
If I have downloaded the package into my project why can't it be found, yet there are no errors when importing?
The cholmod file is a pyx file which I've been told should not be a problem.
Please could anyone help, I am reasonably new to python and I am looking for a straight forward solution that won't be time consuming.
It was an issue with windows, I was able to fix this using the instructions on this link
https://github.com/EmJay276/scikit-sparse
We must follow these steps precisely:
(This was tested with a Anaconda 3 installation and Python 3.7)
Install these requirements in order:
'''
conda install -c conda-forge numpy - tested with v1.19.1
conda install -c anaconda scipy - tested with v1.5.0
conda install -c conda-forge cython - tested with v0.29.21
conda install -c conda-forge suitesparse - tested with v5.4.0
'''
Download Microsoft Build Tools for C++ from https://visualstudio.microsoft.com/de/visual-cpp-build-tools/ (tested with 2019, should work with 2015 or newer)
Install Visual Studio Build Tools
Choose Workloads
Check "C++ Buildtools"
Keep standard settings
Run ''' pip install git+https://github.com/EmJay276/scikit-sparse '''
Test ''' from sksparse.cholmod import cholesky '''
Use all the versions stated for numpy etc, however with scipy I installed the latest version and it worked fine.

Error while running azuremlsdk::install_azureml() in R

I'm trying to load an existing azure workspace in RStudio Azure Compute Instance like it's shown in this link: https://azure.github.io/azureml-sdk-for-r/. But, after installing azuremlsdk package when I'm running this code azuremlsdk::install_azureml(). I'm getting this error :
Attempting uninstall: certifi  Found existing installation: certifi2016.9.26ERROR: Cannot uninstall 'certifi'. It is a distutilsinstalled project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.Error: Error installing package(s): 'azureml-sdk==1.10.0', 'numpy', 'pandas'
By referring to this link : https://learn.microsoft.com/en-us/azure/machine-learning/how-to-troubleshoot-environments; I tried to fix this error by running conda remove certifi through terminal of that Compute Instance & Jupyter Notebook of that Compute Instance. But, no luck.
Does anyone have any experience in resolving this issue. Please help.
Azure ML has issues with Python versions and its dependency packages, make sure you are using Python package of 3.5 to 3.8 while installing these.
While installing azureml it will search for all the dependency packages and will install all of them, in this process there will be the version issues, like pandas, numpy.. with different pip versions.
From your stack trace looks like the error is happening when we install the packages like pandas numpy etc along with azureml-train-automl-client package so try to install them before hand by checking its versions which are dependent with you python versions packages.
Check the Azure ML documentation for installation of Azure ML Additional packages.
If you investigate them azureml-train-automl requires somes data science packages including pandas, numpy, and scikit-learn.
Kindly follow below commands for conda environment:
pip install azureml-train-automl
pip install --upgrade azureml-train-automl
pip install show azureml-train-automl
It seems that the Python SDK installation conflicts with itself when using Python 3.6 (the default). I was able to install the SDK for Python 3.7:
azuremlsdk::install_azureml(conda_python_version = '3.7')

Python OpenCV Installation - DLL error while importing cv2

I've been trying to set up OpenCV on my computer for the past 3 days and haven't able to install it.
I have tried different versions of Python and OpenCV but nothing seems to be working as I'm always getting an error:
DLL error while importing cv2: The specified module could not be found.
Can someone help me to set up python, anaconda, OpenCV on my computer as I'm now completely frustrated as I've tried almost 30 different methods but in vain.
You can download the latest OpenCV 3.2.0 for Python 3.6 on Windows 32-bit or 64-bit machine, look for file starts withopencv_python‑3.2.0‑cp36‑cp36m, from this unofficial site. Then type below command to install it:
pip install opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl (32-bit version)
pip install opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl (64-bit version)
I think it would be easier.
Try running:
pip install opencv-contrib-python

PINAX & PIL Installation on Windows 7

I have Python 2.7 on Windows 7 x64. I have installed virtualenv and installed Pinax withing the project in virtualenv. When I try to syncdb I recieve an error stating PIL is needed. I tried installing PIL 1.1.7 for 2.7, but it did not install correctly. When I ran syncdb I get the following error.
Error: One or more models did not validate:
photologue.photo: "image": To use ImageFields, you need to install the Python Im
aging Library. Get it at http://www.pythonware.com/products/pil/ .
photologue.watermark: "image": To use ImageFields, you need to install the Pytho
n Imaging Library. Get it at http://www.pythonware.com/products/pil/ .
avatar.avatar: "avatar": To use ImageFields, you need to install the Python Imag
ing Library. Get it at http://www.pythonware.com/products/pil/ .
photos.image: "image": To use ImageFields, you need to install the Python Imagin
g Library. Get it at http://www.pythonware.com/products/pil/ .
As I understand it is because this is a x32. So I downloaded the unoffical x64 version from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil and tried to install. Windows installer states that it can not locate python so it can not install PIL. I checked the registry and python is there.
Any thoughts because I am lost?
It's been awhile since I worked on Windows, but I believe you might need to install a 64-bit version of Python. I could be wrong, but I wouldn't think that 32-bit Python would be able to run 64-bit libraries. I think the error message you are seeing is that the 64-bit PIL is looking for 64-bit Python and can't find it.
You can install 32 bit PIL on Win7x64 as long as you are running 32 bit Python.

Categories