Skip to content

Commit

Permalink
Clarify the notebook path (#2569)
Browse files Browse the repository at this point in the history
Address user feedback from Qiskit Slack

---------

Co-authored-by: Eric Arellano <[email protected]>
  • Loading branch information
beckykd and Eric-Arellano authored Jan 21, 2025
1 parent 0582f02 commit 405efcd
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 39 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ graphviz`.
```
- To only execute specific notebooks, pass them as arguments.
```sh
tox -- path/to/notebook.ipynb path/to/another-notbook.ipynb
tox -- <path/to/notebook.ipynb> <path/to/another-notebook.ipynb>
```
- To write the execution results to the file, pass the `--write` argument.
```sh
Expand Down Expand Up @@ -230,7 +230,7 @@ Some problems can be fixed automatically. To fix these problems, run:
tox -e fix

# Fix problems in a specific notebook
tox -e fix -- path/to/notebook
tox -e fix -- <path/to/notebook>
```

If you use the Jupyter notebook editor, consider adding squeaky as a [pre-save
Expand Down
30 changes: 15 additions & 15 deletions docs/guides/install-qiskit-source.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ description: Learn how to install the development version of Qiskit.
---
# Install the Qiskit SDK and Qiskit Runtime from source

Installing the Qiskit SDK from source allows you to access the current development version, instead of using the version in the Python Package Index (PyPI) repository. This lets you inspect and extend the latest version of the Qiskit code more efficiently.
Installing the Qiskit SDK from source allows you to access the current development version, instead of using the version in the Python Package Index (PyPI) repository. This lets you inspect and extend the latest version of the Qiskit code more efficiently.

## Create and activate a new virtual environment

1. Create a minimal environment with only Python installed in it.
1. Navigate to your project directory and create a minimal environment with only Python installed in it.

<OperatingSystemTabs>
<TabItem value="mac" label="macOS">
```shell
python3 -m venv /path/to/virtual/environment
python3 -m venv .venv
```
</TabItem>

<TabItem value="linux" label="Linux">
```shell
python3 -m venv /path/to/virtual/environment
python3 -m venv .venv
```
</TabItem>

<TabItem value="win" label="Windows">
```text
python3 -m venv c:\path\to\virtual\environment
python -m venv .venv
```
</TabItem>
</OperatingSystemTabs>
Expand All @@ -36,26 +36,26 @@ Installing the Qiskit SDK from source allows you to access the current developme
<OperatingSystemTabs>
<TabItem value="mac" label="macOS">
```shell
source /path/to/virtual/environment/bin/activate
source .venv/bin/activate
```
</TabItem>

<TabItem value="linux" label="Linux">
```shell
source /path/to/virtual/environment/bin/activate
source .venv/bin/activate
```
</TabItem>

<TabItem value="win" label="Windows">
```text
c:\path\to\virtual\environment\Scripts\Activate.ps1
.venv\Scripts\Activate.ps1
```
</TabItem>
</OperatingSystemTabs>

## Install the Rust compiler

A Rust compiler must be installed on your system to compile Qiskit. To install the Rust compiler, use the cross-platform Rust installer [rustup](https://rustup.rs/) or [another install method.](https://forge.rust-lang.org/infra/other-installation-methods.html)
A Rust compiler must be installed on your system to compile Qiskit. To install the Rust compiler, use the cross-platform Rust installer [rustup](https://rustup.rs/) or [another install method.](https://forge.rust-lang.org/infra/other-installation-methods.html)

## Install Qiskit

Expand All @@ -67,7 +67,7 @@ Follow these steps to install Qiskit:
git clone https://github.com/Qiskit/qiskit.git
```

2. Change to the `qiskit` directory.
2. Change to the `qiskit` directory.

```bash
cd qiskit
Expand All @@ -79,9 +79,9 @@ cd qiskit
pip install -r requirements-dev.txt
```

4. Install `qiskit`.
4. Install `qiskit`.

* **Standard install**:
* **Standard install**:

```bash
pip install .
Expand Down Expand Up @@ -113,7 +113,7 @@ Follow these steps if you want to install Qiskit Runtime:
git clone https://github.com/Qiskit/qiskit-ibm-runtime.git
```

2. Change to the `qiskit-ibm-runtime` directory.
2. Change to the `qiskit-ibm-runtime` directory.

```bash
cd qiskit-ibm-runtime
Expand All @@ -127,7 +127,7 @@ pip install -r requirements-dev.txt

4. Install `qiskit-runtime`. We recommend using a [virtual environment](https://docs.python.org/3/library/venv.html) to avoid polluting your global Python installation.

* **Standard install**:
* **Standard install**:

```bash
pip install .
Expand All @@ -139,7 +139,7 @@ pip install -r requirements-dev.txt
pip install -e .
```

In editable mode, the compiled extensions are built in _debug mode_ without optimizations.
In editable mode, the compiled extensions are built in _debug mode_ without optimizations.


## Next steps
Expand Down
32 changes: 22 additions & 10 deletions docs/guides/install-qiskit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ Whether you will work locally or in a cloud environment, the first step for all

One important advantage of a virtual environment is that if your Python environment becomes corrupted somewhere along the way, you can easily delete the virtual environment and start over!

Choose a preferred location in which to store information about your virtual environments. Commonly they're stored in a directory named `.venv` within a user's home directory.
Choose a preferred location in which to store information about your virtual environments. Typically they're stored in a directory named `.venv` within each project directory you're working in.
</details>

First, create a minimal environment with only Python installed in it.
First, navigate to your project directory and create a minimal environment with only Python installed in it.

<OperatingSystemTabs>
<TabItem value="mac" label="macOS">
```shell
python3 -m venv /path/to/virtual/environment
python3 -m venv .venv
```
</TabItem>

<TabItem value="linux" label="Linux">
```shell
python3 -m venv /path/to/virtual/environment
python3 -m venv .venv
```
</TabItem>

<TabItem value="win" label="Windows">
```text
python3 -m venv c:\path\to\virtual\environment
python -m venv .venv
```
</TabItem>
</OperatingSystemTabs>
Expand All @@ -75,19 +75,31 @@ Whether you will work locally or in a cloud environment, the first step for all
<OperatingSystemTabs>
<TabItem value="mac" label="macOS">
```shell
source /path/to/virtual/environment/bin/activate
source .venv/bin/activate
```
</TabItem>

<TabItem value="linux" label="Linux">
```shell
source /path/to/virtual/environment/bin/activate
source .venv/bin/activate
```
</TabItem>

<TabItem value="win" label="Windows">
If using PowerShell:

```text
.venv\Scripts\Activate.ps1
```
If using Git Bash:

```text
source .venv/scripts/activate
```
If using command prompt:

```text
c:\path\to\virtual\environment\Scripts\Activate.ps1
.venv\Scripts\activate
```
</TabItem>
</OperatingSystemTabs>
Expand Down Expand Up @@ -122,15 +134,15 @@ Whether you will work locally or in a cloud environment, the first step for all
</Tabs>


1. If you want to run a Jupyter notebook with the Qiskit packages you just installed, you will need to install Jupyter in your environment.
1. If you want to run a Jupyter notebook with the Qiskit packages you just installed, you need to install Jupyter in your environment.

```shell
pip install jupyter
```
Then open your notebook as follows:

```shell
jupyter notebook path/to/notebook.ipynb
jupyter notebook <path/to/notebook.ipynb>
```

If you are planning to work locally and use simulators built into Qiskit, then your installation is done. If you want to run jobs on IBM QPUs, next [select an access channel](setup-channel) and finish your setup.
Expand Down
22 changes: 11 additions & 11 deletions docs/migration-guides/qiskit-1.0-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ PowerShell is used for Windows commands.
<span id="creating-a-venv"></span>
### Create the new environment

1. Create a new virtual environment, using your preferred version of Python 3.8 or later. Use any path you choose in place of `/path/to/qiskit-1.0-venv`.
1. Create a new virtual environment in each project directory you're working in, using your preferred version of Python 3.8 or later.

<OperatingSystemTabs>
<TabItem value="mac" label="macOS">
```bash
python3 -m venv /path/to/qiskit-1.0-venv
python3 -m venv .venv
```
</TabItem>

<TabItem value="linux" label="Linux">
```bash
python3 -m venv /path/to/qiskit-1.0-venv
python3 -m venv .venv
```
</TabItem>

<TabItem value="win" label="Windows">
```powershell
python3 -m venv C:\path\to\qiskit-1.0-venv
python -m venv .venv
```
</TabItem>
</OperatingSystemTabs>
Expand All @@ -66,19 +66,19 @@ PowerShell is used for Windows commands.
<OperatingSystemTabs>
<TabItem value="mac" label="macOS">
```bash
source /path/to/qiskit-1.0-venv/bin/activate
source .venv/bin/activate
```
</TabItem>

<TabItem value="linux" label="Linux">
```bash
source /path/to/qiskit-1.0-venv/bin/activate
source .venv/bin/activate
```
</TabItem>

<TabItem value="win" label="Windows">
```powershell
C:\path\to\qiskit-1.0-venv\Scripts\activate.ps1
.venv\Scripts\activate.ps1
```
</TabItem>
</OperatingSystemTabs>
Expand Down Expand Up @@ -126,24 +126,24 @@ PowerShell is used for Windows commands.
<span id="activating-a-venv"></span>
### Use the new environment

Each time you start a new command line session, you must "activate" the environment by running the `activate` command:
Each time you start a new command line session, you must navigate to your project directory and "activate" the environment by running the `activate` command:

<OperatingSystemTabs>
<TabItem value="mac" label="macOS">
```bash
source /path/to/qiskit-1.0-venv/bin/activate
source .venv/bin/activate
```
</TabItem>

<TabItem value="linux" label="Linux">
```bash
source /path/to/qiskit-1.0-venv/bin/activate
source .venv/bin/activate
```
</TabItem>

<TabItem value="win" label="Windows">
```powershell
C:\path\to\qiskit-1.0-venv\Scripts\activate.ps1
.venv\Scripts\activate.ps1
```
</TabItem>
</OperatingSystemTabs>
Expand Down
1 change: 1 addition & 0 deletions scripts/config/cspell/dictionaries/qiskit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Hadamard
Hamiltonians
IBMQPU
ITTL
ipynb
Ipython
MCMT
MCMTV
Expand Down
2 changes: 1 addition & 1 deletion scripts/nb-tester/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ To use this tool, just run the `test-docs-notebooks` command, followed by a
list of notebooks you'd like to execute.
```
test-docs-notebooks path/to/notebook.ipynb path/to/another.ipynb
test-docs-notebooks <path/to/notebook.ipynb> <path/to/another.ipynb>
```
* To write the executed notebooks to disk, include the `--write` argument.
Expand Down

0 comments on commit 405efcd

Please sign in to comment.