Problem in installing matplot library using conda - python

I am trying to create new environments and to install the necessary package. However, when I try to install Matplot lib, I am getting the following error InvalidArchiveError('Error with archive C:\\Users\\X\\Anaconda3\\pkgs\\openssl-1.1.1h-he774522_0.tar.bz2. You probably need to delete and re-download or re-create this file. Message from libarchive was:\n\nCould not unlink'). I tried to use conda clear -a to remove all files and then try to install matplotlib using conda install -c conda-forge matplotlib but getting the same error.
Any idea how to solve this issue? Thanks in advance.

Related

Unable to run or reinstall or update yfinance

I have been using the package yfinance to retrieve stock prices for some time. Recently, as noted in several online posts, the package stopped working due to an update to the package. I thought that this would be a simple process to update the package and fix the problem. This has not been the case.
I am using Anaconda so I want to update using conda instead of pip using PowerShell on a PC.
What I have tried so far unsuccessfully
$ conda update --all
$ conda update conda
$ conda update-c ranaroussi yfinance
None of these worked. I tried to uninstall and then reinstall Anaconda then reinstall yfinance. Yes, I agree that this seemed like overkill for what should have been a simple issue. Unfortuntaelty, now I can't even install the package. I am using the conda command that I originally used to install the package
$ conda install -c ranaroussi yfinance
, which comes from the developer's page.
https://anaconda.org/ranaroussi/yfinance
Now, I try to run this I receive an error message that the package cannot be found in my current channels.
Screenshot of error msg.
At this point, I am just spinning my wheels and would appreciate some help. I hope that someone who might have experienced a similar issue has a suggestion for how to resolve this problem.
Thanks
Even though it's hosted on anaconda.org, this package doesn't appear to be a conda package. Its page only lists PyPI source and a one-liner to install with pip; i.e. compare it to a typical conda package. Probably best here to just pip install yfinance into a conda environment.

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.

AttributeError: module 'fiona' has no attribute '_loading'

I am new in python and I am trying to work with geopandas library. I have already installed the package using:
conda install -c conda-forge geopandas
but when I try to import the library, I get back:
ERROR SCREENSHOT
But searching in my computer directories I have already installed fiona and inside this directory, there is a file "_loading.py"
Isn't it strange that I have both packages installed and I have this error?
Thank you in advance
If you are using Jupyter Notebook or JupyterLab, you may just need to restart the kernel for the environment.
First, install python=3.7 then download the related library with the same version of python from here. https://www.lfd.uci.edu/~gohlke/pythonlibs.
install all of them using pip

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.

Missing optional dependency 'tables'. In pandas to_hdf

following code is giving me error.
import pandas as pd
df = pd.DataFrame({'a' : [1,2,3]})
df.to_hdf('temp.h5', key='df', mode='w')
This is giving me error.
Missing optional dependency 'tables'. Use pip or conda to install tables.
I already tried
ImportError HDFStore requires PyTables No module named tables. Still the same error.
I am getting the same error when reading hdf file. And tables are already installed for my python.
Some version info.
python 3.7.4
pandas 0.25.2
windows10
PS: You can reproduce this in repl https://repl.it/.
Update:
I tried runnig following.
import tables
and got this error:
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path.
It looks like pandas is not giving accurate message for this. Its just saying missing dependency when its actually present.
If anyone knows how to resolve this. That will help.
For conda users:
conda install pytables
The issue was with tables.
When i was installing tables using pip into local user directory using following command it's not working.
pip install --user tables
Running import tables will result in this error.
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path
The solution that worked for me is to uninstall tables. And install it into python's directory. (or where your python is installed). without --user option. You may require admin/root access for this depending upon location of your python.
For me my python path was C:\Program Files\Python37-64\python.exe and installing under c:\program files\python37-64\lib\site-packages\ worked for me.
Hope this helps. I don't know why installing in user directory is not working for tables. If anyone can find the reason for that please post here.
I got it to work by using
conda install snappy
using tables 3.6.1 worked for me to resolve the dependency
pip install tables==3.6.1
I used following command successfully resolved this problem:
pip install --upgrade tables
hope that work for you !
This problem has appeared for me when refreshing an existing conda virtal env using pip install -U -r requirements.txt. I resolved the issue as follows:
conda env remove -n <env> # remove your virtual env.
conda create -n <env> python==3.8 # create your virtual env again.
pip install -U -r requirements.txt
It's quite tedius to maintain a mix of conda and pip packages, so I just use the latter.
The above solutions did not work for me. Perhaps because I built the individual environment using the conda-forge channel, I had success with this:
conda install -c conda-forge pytables

Categories

Resources