Python sklearn installation windows - python

When trying to install Python's sklearn package on Windows 10 using pip I am given an EnvironmentError that tells me there is no such file or directory of a specific file:
ERROR: Could not install packages due to an EnvironmentError: [Errno
2] No such file or directory:
'C:\Users\Rik\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sklearn\datasets\tests\data\openml\292\api-v1-json-data-list-data_name-australian-limit-2-data_version-1-status-deactivated.json.gz'
I have tried reinstalling the following packages numerous times:
scikit-learn
scipy
sklearn
I have also tried downloading the github master folder for sklearn and pasting it into the directory where the installer expects the file to be, and even then when installing with pip it tells me the file is missing.
Furthermore I tried installing it via the github repository by downloading it and running
python setup.py install
But this results in weird Microsoft Visual Studio errors because apparently it is trying to run a test program or something, not sure.
Any suggestions to fix this problem?

You can find the solution here: https://scikit-learn.org/stable/install.html
The problem occurs because the default path size limit is reached in your case, you can change this with the following steps:
open regedit tool (using windows cmd)
access the 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem' key
change the 'LongPathsEnabled' value to 1
reinstall sklearn using the command 'pip install --exists-action=i scikit-learn'

Related

Cannot install python by requirements.txt

I try to install the python package using the following command line in anacondaprompt:
(base) C:\Users\Lenovo>pip install -r D:\autoencoder\Website_by_python\requirements.txt
Then the error is shown as
Processing c:\tmp\build\80754af9\backports.functools_lru_cache_1618170165463\work
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\tmp\\build\\80754af9\\backports.functools_lru_cache_1618170165463\\work'
I don't really know how to deal with that error. Could you please tell me?
Could not install packages due to an OSError
is always related to administrator privileges or even worse the python version that visual studio installs by default i suggest you to
uninstall python
delete the python extension from vs code
delete the python version in the data folder you can access it by run %temp% and in the address bar click on app data from there look for python
finally reinstall python i suggest you directly to C: without any version numbers i.e c:/Python dont forget to click add variables to path then open visual studio again and let him install the python extension again
omg i just noticed you talk about anaconda nevertheless it should be exactly the same problem

Pandas installation fails with "OSError: [WinError8] Not enough storage is available to process this command"

I was trying to install pandas using this command:
python -m pip install pandas
Installation starts initially but then goes all red and returns this error:
Could not install packages due to an OSError: [WinError8] Not enough storage is available to process this command
--- Logging error ---
I don't think it's a memory issue because I checked usage and it was at a normal level.
I'm using Python 3.7 on Windows 7.
Any suggestions on how to fix it??
Eureka! I'm posting solution in case anyone encounters the same problem in the future.
After hours of trying a lot of different solutions I have finally succeed even though I still don't know what was the source of this problem.
To install pandas in case of facing error while downloading using pip command first download manually .whl files of pandas from PyPI website:
https://pypi.org/project/pandas/#files
Copy it to the folder that is used as your path in cmd console- don't change name of the file.
In cmd console use:
python -m pip install fullnameofthedownloadedfile.whl --no-deps
Use --no-deps as it's very likely that automatically downloaded dependencies will encounter similar errors during downloading as pandas- you will install them manually instead.
Once this is finished repeat process for numpy and dateutil and any other packages that might be required.
What a relief!!! Happy coding;)

Need help installing fiona and geopandas for python in Windows 10 - getting can't load requested DLL error

I am trying to install fiona and geopandas for python on Windows 10 and keep running into an error "ERROR 1: Can't load requested DLL".
I know this question is similar to other questions that have been asked, but I have followed the steps in multiple answers and tutorials and still can't seem to get this to work.
The closest I got was using the steps outlined in this tutorial : https://geoffboeing.com/2014/09/using-geopandas-windows/
and are summarized as follows:
installed the .whl files for rtree, pyproj, shapely, gdal, geopandas, fiona from https://www.lfd.uci.edu/~gohlke/pythonlibs/
Rtree-0.8.3-cp37-cp37m-win_amd64.whl
pyproj-2.2.1-cp37-cp37m-win_amd64.whl
GDAL-3.0.0-cp37-cp37m-win_amd64.whl
geopandas-0.5.0-py2.py3-none-any.whl
Fiona-1.8.6-cp37-cp37m-win_amd64.whl
Shapely-1.6.4.post2-cp37-cp37m-win_amd64.whl
navigated to download folder and used pip install to install GDAL wheel
added the osgeo path to my windows user Path environment variable
used pip install to install remaining wheels (geopandas last), everything installed without errors
As a check, I ran gdalinfo --help-general and get the following output:
This is where I get the "ERROR 1: Can't load requested DLL:" error. It says it cannot find the specified module "ogr_FileGDB.dll". The weird thing is, that .dll is actually in the location that it is looking in???
Also, in python shell, when trying to import fiona or geopandas I get the following errors:
This is beyond my level of troubleshooting...would really appreciate if anyone could get this thing working for me!!!!
FYI - running Python 3.7.3, Windows 10, pip is updated.
Lastly and potentially important (not sure how it plays in?) I already have a GDAL_DATA system variable defined, and also (maybe incorrectly?) also tried adding the osgeo path to my system path variable:
I was using a GDAL version that was not compatible with Fiona and subsequently causing issues with geopandas.
I uninstalled GDAL 3 and installed GDAL 2.4.1 and it worked fine, as cgohlke suggested.
Install fiona with conda, then that will solve the GDAL problem. pip install geopandas should work after that.

Anaconda "import georaster" error: specified module not found

I am using Anaconda3 5.2.0 for Windows 10 64 bit, which is python 3.6.5 (Anaconda3-5.2.0-Windows-x86_64.exe). I have installed this into C:\Anaconda3 and then from the anaconda prompt installed basemap:
conda install -c conda-forge basemap
conda install -c conda-forge basemap-data-files
I have used this to start building map files and everything is working fine. I then wanted to add a raster to the map using georaster.
conda install -c conda-forge georaster
This also installs gdal.
When I open Jupyter Notebook and enter the line
import georaster
I get the following error message:
ImportError: DLL load failed: The specified module could not be found.
I have tried various solutions that I have seen for related issues including installing a gdal update, fiona, and geopandas. None of these change the message.
I tried installing gdal using the binaries .whl file in conda, but despite following the advice (which said to use pip) I was not able to make it work.
pip install GDAL-2.2.4-cp37-cp37m-win_amd64.whl
resulted in an error message:
GDAL-2.2.4-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
Finally I went looking to see if I could locate the missing DLL manually. I saw one user suggest libtiff.dll was the missing file, and indeed it was one I did not have. I downloaded it and copied it into the System32 and SysWOW64 folders. This still resulted in an error but changed the error message:
ImportError: DLL load failed: %1 is not a valid Win32 application.
However I could not find a way to stop the error from occurring. I followed the steps to register the .dll but that also had an error message from not found to not supported:
(cmd prompt in administrator mode)
regsvr32.exe /i libtiff.dll
The module "libtiff.dll" failed to load.
Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files.
The specified module could not be found.
I have tried downloading from 2 other websites, neither with any success. It is feeling like every method I attempt now just hits some weird error that nobody else is seeming to have and I don't understand why.
If anyone could offer some advice I'd be very appreciative. Thank you in advance.
downloading the required *.whl file(GDAL-2.2.4-cp36-cp36m-win_amd64.whl) from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal and then copying it to a location like C:\GDAL-2.2.4-cp36-cp36m-win_amd64.whl
then pip install c:\GDAL-2.2.4-cp36-cp36m-win_amd64.whl
worked for me.
Thanks.

Installing Kartograph / GDAL / Etc. with PIP and virtualenv

Running into a few different problems here. Trying to install Kartograph and first installing dependencies. Here are my steps and results thus far:
Install GDAL from .pkg. Goes well. No problems here.
Try to install Kartograph using the default instructions for OSX with several packages. This fails with the following errors:
File "", line 4, in
main.gdal_config_error: [Errno 2] No such file or directory
Command python setup.py egg_info failed with error code 1 in
/Users/chris/ENV/build/GDAL
Ok, no dice. So then I try the install excluding GDAL as that seems to be presenting a problem to pip's install of Kartograph. That doesn't work either and produces the following errors:
raise KeyError('please set the environment variable PROJ_DIR to point to the location of your proj.4 installation')
KeyError: 'please set the environment variable PROJ_DIR to point to
the location of your proj.4 installation'
---------------------------------------- Command python setup.py egg_info failed with error code 1 in /Users/chris/ENV/build/pyproj
Now, I've edited the activate script of my virtualenv with the PYTHONPATH variable assignment per the Kartograph documentation. However, not sure that helped or has changed anything.
Has anyone run into a similar sequence of errors and if so, how did you solve this issue?
I managed to fix this error but now I'm stuck at another error.
Anyway this is what I did:
I installed the PROJ framework package from here:
http://www.kyngchaos.com/software/frameworks
Then I ran the following in Terminal to add the installation path to PROJ_DIR (as instructed in the error message):
$ export PROJ_DIR=$PROJ_DIR:/Library/Frameworks/PROJ.framework/Programs
Apparently PROJ is included in the GDAL framework so maybe the first step is unnecessary.
Update: It seems the path is lost when you close Terminal

Categories