Skip to content

[Windows] PermissionError in datasets fetchers when trying to remove the downloaded archive #9820

Closed
@lucianocrt

Description

@lucianocrt

Description

I have just intalled scikit-learn though pip. I am trying to load a dataset (california_housing) but I keep getting a permission error when scikit-learn tries to delete the file.
I can delete the file myself from the file explorer, which suggests that it is python that locks the file.

Steps/Code to Reproduce

import numpy as np
from sklearn.datasets import fetch_california_housing

housing = fetch_california_housing()

Expected Results

No error should be thrown and data should be loaded correctly

Actual Results

Downloading Cal. housing from https://ndownloader.figshare.com/files/5976036 to C:\Users\lucia\scikit_learn_data
Traceback (most recent call last):
File "test.py", line 4, in
housing = fetch_california_housing()
File "C:\Users\lucia\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\datasets\california_housing.py", line 109, in fetch_california_housing
remove(archive_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\lucia\scikit_learn_data\cal_housing.tgz'

Versions

Windows-10-10.0.15063-SP0
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)]
NumPy 1.13.1
SciPy 0.19.1
Scikit-Learn 0.19.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions