Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to qiskit 0.7 removes some mandatory files in the qiskit directory #1599

Closed
t-imamichi opened this issue Dec 26, 2018 · 6 comments
Closed

Comments

@t-imamichi
Copy link
Member

t-imamichi commented Dec 26, 2018

Informations

  • Qiskit Terra version: 0.6.1 -> 0.7
  • Python version: 3.6.7
  • Operating system: Ubuntu 18.10 (this issue may occur for any platform)

What is the current behavior?

If users upgrade qiskit 0.6.* to 0.7 by pip install -U qiskit, some mandatory files in the qiskit directory (site-packages/qiskit) will be removed while upgrading. It causes unintentional errors like #1582. Such users cannot use qiskit without any workaround.

Steps to reproduce the problem

$ # make a clean environment (you can use any environment management such as pyenv)
$ python3 -m venv ~/envs/test
$ source ~/envs/test/bin/activate
$ pip install -U pip setuptools wheel
$ pip install qiskit==0.6.1
$ pip install -U qiskit  # upgrade to 0.7
$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import qiskit
>>> qiskit.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'qiskit' has no attribute '__version__'

What is the expected behavior?

$ # make a clean environment
$ python3 -m venv ~/envs/test
$ source ~/envs/test/bin/activate
$ pip install -U pip setuptools wheel
$ pip install qiskit==0.6.1
$ pip install -U qiskit  # upgrade to 0.7
$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import qiskit
>>> qiskit.__version__
'0.7.0'

Cause

The main cause is pip install -U qiskit. It installs modules as follows.

  • Step 1. Install dependencies, qiskit-aer and qiskit-terra
  • Step 2. Uninstall qiskit==0.6.1
  • Step 3. Install qiskit==0.7
    (I refer the steps later)

The file list of site-packages/qiskit when upgrading 0.6 to 0.7 is as follows.

circuit
converters
mapper
providers
__pycache__
qiskiterror.py
qobj
quantum_info
result
tools
transpiler
unrollers
unroll.py
validation

The file list of site-packages/qiskit when clean installing 0.7 is as follow.

circuit
converters
dagcircuit
extensions
__init__.py
mapper
providers
__pycache__
qasm
qiskiterror.py
qobj
quantum_info
result
schemas
tools
transpiler
unrollers
unroll.py
_util.py
validation
VERSION.txt
wrapper

There are missing files such as __init__.py when upgrading 0.6 to 0.7. The reason is as follows.

  • Step 1 installs qiskit-terra as dependency
  • Step 2 uninstalls qiskit==0.6.1. It removes some files such as __init__.py that are included in both qiskit==0.6.1 and qiskit-terra.
  • Although Step 3 installs qiskit==0.7, it does not have the removed files because they moved to qiskit-terra.

Suggested solutions

I recommend to write a document how to upgrade from qiskit==0.6.* to qiskit==0.7. This behavior of upgrading qiskit is unpredictable for users.

Users need to reinstall qiskit-terra to deal with this issue. Workarounds are as follows.

$ pip uninstall qiskit-terra
$ pip install qiskit-terra

or

$ pip install --force-reinstall qiskit-terra  # it takes a long time to reinstall all dependencies

or

$ pip install --force-reinstall qiskit  # it takes a longer time to reinstall all dependencies

Note that reinstalling only qiskit does not work because some files in qiskit-terra are still missing.

$ pip uninstall qiskit
$ pip install qiskit
$ python
>>> import qiskit
>>> qiskit.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'qiskit' has no attribute '__version__'
@diego-plan9
Copy link
Member

Thanks @t-imamichi for reporting - it seems indeed that in some case the order of uninstalling and installing qiskit-terra is not correct, rippling in the issue you are experiencing. Indeed, some documentation would help (maybe at https://github.com/Qiskit/qiskit, as it already has a 0.6 to 0.7 stub) - in the meantime, let's leave the issue open during these holiday-ish days in case anyone experiences the same.

@jaygambetta jaygambetta added this to To do in Test, CI, installation, and QA via automation Dec 29, 2018
@jaygambetta jaygambetta added this to To do in Documentation via automation Dec 29, 2018
@jaygambetta jaygambetta moved this from To do to In Disscussion in Documentation Dec 29, 2018
@ajavadia
Copy link
Member

ajavadia commented Jan 7, 2019

Hi @t-imamichi, thank you for pointing this out and also helping with documentation in
https://github.com/t-imamichi/qiskit-utility/wiki/Unofficial-installation-guide-of-qiskit.

Could you please make a PR for documentation that includes this info? Probably in the global Qiskit repository would be the best (and linking to it in Terra). Because your notes are related to pip install qiskit, and also contains some information about aqua.

Thanks.

@delapuente
Copy link
Contributor

Perhaps we can modify the qiskit metapackage to make it work and update it to 0.7.1. I've open an issue there #27.

@t-imamichi
Copy link
Member Author

@ajavadia Yes. I try to merge my documentation into the global one and make a PR.

@delapuente Good news! I hope 0.7.1 resolves this issue.

@ajavadia
Copy link
Member

This is being tracked in the meta repo: #27

Test, CI, installation, and QA automation moved this from To do to Done Jan 13, 2019
Documentation automation moved this from In Disscussion to Done Jan 13, 2019
@jb77777
Copy link

jb77777 commented May 6, 2020

I had the same issue while installing qiskit, "init.py" was missing with several other. I used the workaround and it fixed the issue. Thanks for sharing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants