Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

Weird behavior installing qiskit with "pip -t" #1559

Closed
Failxxx opened this issue Jun 30, 2022 · 4 comments
Closed

Weird behavior installing qiskit with "pip -t" #1559

Failxxx opened this issue Jun 30, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Failxxx
Copy link

Failxxx commented Jun 30, 2022

Informations

  • Qiskit version: 0.36.2
  • Python version: 3.10.2
  • Operating system: Windows 10 21H2 (19044.1766) and Ubuntu 22.04 LTS

What is the current behavior?

When I install qiskit using this command line:
Windows --> path/to/bin/python.exe -m pip install qiskit -t path/to/custom/folder
Ubuntu --> sudo path/to/bin/python3.10 -m pip install -t path/to/custom/folder
The installation seems to go through all the steps as intended. No error message shows up.

However, the qiskit folder located at path/to/custom/folder/qiskit is almost empty. The folder only contains one file named __init__.pxd.
It is then impossible to use qiskit (no modules found on import).

Steps to reproduce the problem

  • Create a new conda env: conda create -n "test_qiskit_install" python=3.10
  • Run: conda activate test_qiskit_install
  • Run: pip install wheel
  • Run: pip install qiskit --upgrade --no-cache-dir -t "path/to/custom/folder" (for me it is "C:\Users\felix\miniconda3\envs\test_qiskit_install\Lib\site-packages"

What is the expected behavior?

The expected behavior is to have qiskit installed properly (with all modules in the qiskit folder).

Suggested solutions

@Failxxx Failxxx added the bug Something isn't working label Jun 30, 2022
@Failxxx Failxxx changed the title Weird bahvior installing qiskit with "pip -t" Weird behavior installing qiskit with "pip -t" Jun 30, 2022
@jakelishman
Copy link
Member

This looks like a rather unusual mixture of different packaging solutions, and extra complication. Qiskit is installed as a namespace package, and I suspect that supplying the -U option in conjunction with -t causes this to fail. The solution is simply to not use either option (or just -U, if you need to upgrade, and not to suppress the warning that arose from qiskit install -t qiskit). Running pip install qiskit should work just fine, even within a conda environment.

@Failxxx
Copy link
Author

Failxxx commented Jun 30, 2022

Ok, I see. When using an anaconda environment, it is ok. But when I use a local python distribution (like in Blender which comes with its own python distribution), I would need to precise the site-packages folder to prevent installing it in an unintended location.
Do you know another way to precise where to install qiskit using pip if the "-t" can't work?

@jakelishman
Copy link
Member

You generally do not need the -t option to pip, if you make sure you're using the pip from the distribution or virtual environment you're trying to install into. -t also seems to be a more low-level/specific form of --prefix, if you're intending to use a particular Python distribution - you probably want --prefix, if it's necessary to use anything.

pip install -t <dir> was never intended for use with namespace packages, so there's not really anything we can do on the Qiskit side for this. You can see some more discussion here: pypa/pip#10110.

@1ucian0
Copy link
Member

1ucian0 commented Jun 28, 2023

closing as not planned.

@1ucian0 1ucian0 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants