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!
Advertisement
Answer
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:
- Right click on the Command Prompt icon
- Select the option
Run This Program As An Administrator
- 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