Python Forum
2 versions of module installed, how to import the earlier one
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 versions of module installed, how to import the earlier one
#1
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"?
Reply
#2
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
Reply
#3
(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
Reply
#4
sorry, I don't use conda, but google search shows:

conda install numpy=1.4.3
with a single '='
Reply
#5
(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
Reply
#6
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
Reply
#7
You just used the command. just specify the version number you want to install in place of the 1.15.4
Reply
#8
(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
Reply
#9
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 265 Feb-17-2024, 12:43 PM
Last Post: deanhystad
  is import cointegration_analysis a recognized module mitcht33 1 384 Nov-06-2023, 09:29 PM
Last Post: deanhystad
  problem in import module from other folder akbarza 5 1,259 Sep-01-2023, 07:48 AM
Last Post: Gribouillis
  can not import anaconda pandas module. PySpark pandas module is imported!! aupres 0 680 Aug-06-2023, 01:09 AM
Last Post: aupres
  import module error tantony 5 3,359 Dec-15-2022, 01:55 PM
Last Post: Lauraburmrs
  Import a module one step back of the path prathampatel9 1 1,036 Sep-21-2022, 01:34 PM
Last Post: snippsat
  ModuleNotFound but pip shows module installed biscotty666 2 1,511 Jul-14-2022, 05:17 PM
Last Post: Axel_Erfurt
  Import a module for use in type hint? Milosz 0 1,455 Nov-08-2021, 06:49 PM
Last Post: Milosz
  Can't install nor import delorean module Tek 3 2,741 Oct-27-2021, 03:32 AM
Last Post: Tek
  Installed versions of Python SamHobbs 5 2,460 Sep-02-2021, 02:28 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020