0

I tried installing yfinance using pip install yfinance and I got:

Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'd:\\users\\myself\\anaconda3\\lib\\site-packages\\numpy\\core\\multiarray.cp36-win_amd64.pyd'
Consider using the '--user' option or check the permissions.

Then tried conda install -c ranaroussi yfinance and got:

UnsatisfiableError: The following specifications were found to be in conflict:
  - scipy
  - yfinance -> numpy >=1.15 -> blas 1.1 openblas
  - yfinance -> numpy >=1.15 -> mkl >=2019.4,<2020.0a0 1.1 openblas
  - yfinance -> numpy >=1.15 -> mkl-service >=2,<3.0a0
Use "conda info <package>" to see the dependencies for each package.

Any idea what's going on and how I can install it? Thanks in advance!

user3709260
  • 431
  • 1
  • 6
  • 18

1 Answers1

2

Case 1: pip

Source: Permission denied error by installing matplotlib

Linux / macOS

From your terminal, you can install the package for your user only, like this:

pip install <package> --user

OR

You can use su or sudo from your terminal, to install the package as root:

sudo pip install <package>

Windows

From the Command Prompt, you can install the package for your user only, like this:

pip install <package> --user

OR

You can install the package as Administrator, by following these steps:

  1. Right click on the Command Prompt icon
  2. Select the option Run This Program As An Administrator
  3. Run the command pip install <package>

P/s: You don't have the right/permission, hence the system block you from installing via pip, you need to be an administrator.

Case 2: conda

This message tells you that the library/package version required by finance has a conflict with the existing preinstalled one. One solution will be create another environment for it.

Source: Anaconda - UnsatisfiableError: The following specifications were found to be in conflict

Create a new conda environment for Python 3:

conda create -n your_virtual_env python=3.7

Create a new conda environment for Python 2.7:

conda create -n your_virtual_env python=2.7

Activate it:

conda activate your_virtual_env

Alternatively, for older conda versions on Windows:

activate your_virtual_env

on Unix (including Mac OS X):

source activate your_virtual_env

Once activated, install your packages:

conda install yfinance
Angus
  • 3,680
  • 1
  • 12
  • 27
  • Thank you! I used pip install yfinance --user as you suggested and it solved the problem but now something bigger happened. I had the following two lines: "from pandas_datareader import data" AND "import pandas_datareader.data as web" and for both of them, I'm getting "ImportError: cannot import name 'urlencode'". I think one of the updates I made ruined everything as this was working fine before yfinance installation. – user3709260 Aug 08 '20 at 03:00
  • Uninstalled pandas_datareader and reinstalled it and all is working fine. Thanks. – user3709260 Aug 08 '20 at 03:31