Python Forum

Full Version: 2 versions of module installed, how to import the earlier one
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Please, help: I want to work with fbprophet and I had error, which I think will be solved if I will use earlier version of numpy.
What I did: I removed numpy and installed numpy 1.15.4.
But when I wrote:
import numpy
print(numpy.__version__)
It is written that I still have version of numpy 1.16.3

Is there code, something like "import numpy=1.15.4"?
pip install --force-reinstall numpy==1.15.4
will replace current version. Careful, other version will be gone when done!

Be aware, that based on your comments, it looks like you have more than one version of python installed.
check version with:
python -V
# then make sure pip matches python
pip -V
# finally pip list to show versions of software installed
(Oct-20-2019, 06:31 PM)Larz60+ Wrote: [ -> ]pip install --force-reinstall numpy==1.15.4
will replace current version. Careful, other version will be gone when done!

Be aware, that based on your comments, it looks like you have more than one version of python installed.
check version with:
python -V
# then make sure pip matches python
pip -V
# finally pip list to show versions of software installed

Thank you for your answer!
1) I use anaconda, can you please write code for anaconda? fbprophet doesn`t work without anaconda
My code was
conda remove numpy
conda install numpy==1.15.4
After that code:
I still had version of numpy 1.16.3 and anaconda stopped work, so I reinstalled anaconda

2)I have only one version of python: 2.7. I think this is because I have python and I have anaconda
sorry, I don't use conda, but google search shows:

conda install numpy=1.4.3
with a single '='
(Oct-20-2019, 09:13 PM)Larz60+ Wrote: [ -> ]sorry, I don't use conda, but google search shows:

conda install numpy=1.4.3
with a single '='

It doesn`t matter as after my code it showed that numpy version was installed successfully
The problem was solved by deleting .condarc file of anaconda and repeating code
conda remove numpy
conda install numpy=1.15.4
However, I still do not know the answer to my question "2 versions of module installed, how to import the earlier one". Maybe I will need to know the answer in the future
You just used the command. just specify the version number you want to install in place of the 1.15.4
(Oct-22-2019, 04:20 AM)Larz60+ Wrote: [ -> ]You just used the command. just specify the version number you want to install in place of the 1.15.4

What do you mean by saying that? The question was how to import, not install
Use virtual environment as this is one of the task it can solve.
Anaconada has own tool for tool for this trough conda(Package, dependency and environment management for any language)

Example.
First install C++ compiler support.
conda install libpython m2w64-toolchain -c msys2
conda install numpy cython -c conda-forge
Now create virtual environment using conda.
λ conda create -n fb_env python=3.7
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: G:\Anaconda3\envs\fb_env

  added / updated specs:
    - python=3.7


The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/win-64::ca-certificates-2019.10.16-0
  certifi            pkgs/main/win-64::certifi-2019.9.11-py37_0
  openssl            pkgs/main/win-64::openssl-1.1.1d-he774522_3
  pip                pkgs/main/win-64::pip-19.3.1-py37_0
  python             pkgs/main/win-64::python-3.7.4-h5263a28_0
  setuptools         pkgs/main/win-64::setuptools-41.4.0-py37_0
  sqlite             pkgs/main/win-64::sqlite-3.30.0-he774522_0
  vc                 pkgs/main/win-64::vc-14.1-h0510ff6_4
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_0
  wheel              pkgs/main/win-64::wheel-0.33.6-py37_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py37_0


Proceed ([y]/n)? y
Activate:
λ conda activate fb_env

(fb_env) G:\Anaconda3
λ pip freeze
certifi==2019.9.11
wincertstore==0.2
Now install pystan(dependency requirement) and fbprophet.
Need also plotly.
(fb_env) G:\Anaconda3
λ pip install pystan
λ pip install fbprophet
λ pip install plotly
As it stuff has a lot dependencies this is now whats'a installed.
Use pip freeze
(fb_env) G:\Anaconda3\envs\fb_env
λ pip freeze
certifi==2019.9.11
convertdate==2.1.3
cycler==0.10.0
Cython==0.29.13
ephem==3.7.7.0
fbprophet==0.5
holidays==0.9.11
kiwisolver==1.1.0
lunardate==0.2.0
matplotlib==3.1.1
numpy==1.17.3
pandas==0.25.2
plotly==4.2.1
pyparsing==2.4.2
pystan==2.19.0.0
python-dateutil==2.8.0
pytz==2019.3
retrying==1.3.3
setuptools-git==1.2
six==1.12.0
wincertstore==0.2
Remember this is now all isolated from main Anaconda or any other python version.
So this will avoid version conflict with previsions install stuff.
Test that it work.
(fb_env) G:\Anaconda3\envs\fb_env
λ python
Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from fbprophet import Prophet
>>> import pandas as pd
>>>
>>> Prophet
<class 'fbprophet.forecaster.Prophet
>>> dir(Prophet)
......
>>> exit()
(fb_env) G:\Anaconda3\envs\fb_env