Skip to content

Conversation

@rjurney
Copy link

@rjurney rjurney commented Mar 3, 2023

Without these libraries you can't actually run any examples, so let's include them! :)

@jkochNU
Copy link
Member

jkochNU commented Mar 3, 2023

Thanks for the pull request, @rjurney !
The environment.yml file is used on the Binder side, so that jupyter should not be required (Binder fills that role). Are you using environment.yml for a local install somehow?

@petergthatsme

  • Reviewing dependencies here, it seems that the pinning of scqubits to 2.0 should be removed, agreed?
  • If we were to include jupyter for reasons tbd, this would install jupyter notebook. Would be nice to give the user a choice to use jupyter lab instead?

@rjurney
Copy link
Author

rjurney commented Mar 3, 2023

@jkochNU what I am doing is this: I want to run the examples in this repo after I clonse it and there is an environment.yml file. I want to create a conda environment to run the examples in that works.

For context, I wrote these precise instructions for installing and testing scqubits in a new conda environment so two of us could make:

How to Install and Test scqubits

  1. Remove the old squbits conda environment

    conda env remove -n scqubits -y

  2. Update the base conda environment - just a good idea to do

    conda update -n base -c defaults conda -y

  3. Create a new conda environment named squbits using Python v3.10.x, do not prompt for yes/no

    conda create -n scqubits -y python=3.10

  4. Activate the new scqubits environment - you must “conda deactivate” if you were already in (scqubits) at your shell

    conda activate scqubits

  5. Install scqubits along with pytest to run the tests

    conda install -c conda-forge -y ipython pytest scqubits

  6. Later, update scqubits to the latest version

    conda update -c conda-forge -y scqubits


Look at how to run tests here: [https://scqubits.readthedocs.io/en/latest/installation.html#installation

](scqubits installation docs)

From bash:

ipython




Then run this Python to test scqubits:



import scqubits.testing as sctestsctest.run()


Now try to run the scqubits-examples and...

You get bugs and errors.

Successfully Running the scqubits Examples with their own environment.yml

  1. Now clone the examples…

    gh repo clone scqubits/scqubits-examples


    OR

    
git clone https://github.com/scqubits/scqubits-examples

  2. Change directories into the examples folder…

    cd scqubits-examples

  3. If you are in scqubits or another conda environment other than (base) at your shell…
    
conda deactivate

  4. Now create a NEW conda environment for the examples specified in environment.yml

    conda env create -n scqubits-examples -f environment.yml

  5. Activate the environment

    conda activate scqubits-examples

  6. Install Jupyter - why isn't it included?
    conda install -y jupyter pytest

  7. Now if you run jupyter notebook you can open any example in the examples folder. It will run!

    jupyter notebook

And... we're spent.

Keep in mind these are rigorous, executable steps I wrote for another person to execute and they ran. I turned these into this PR so the examples themselves would run from their own conda environment specified in environment.yml.

@jkochNU
Copy link
Member

jkochNU commented Mar 3, 2023

I see.

That is not how install was envisioned, but we will have to spell that out in the docs. The example repository environment.yml is strictly meant for Binder.

Outside Binder, the intended workflow is:

  1. Always first: install scqubits via conda install -c conda-forge scqubits
  2. Install any optional dependencies - if you want to run pytests, this requires all optional dependencies specified in scqubits/optional-requirements.txt.
  3. The user should decide whether to install jupyter notebook or jupyterlab.

We would not want Binder to have to install all optional requirements (it's already sluggish in setting up as is).
Fully agree that need to write documentation on this.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants