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

ImportError: No module named 'Qconfig' #62

Closed
AshleyZhao opened this issue Nov 30, 2017 · 6 comments
Closed

ImportError: No module named 'Qconfig' #62

AshleyZhao opened this issue Nov 30, 2017 · 6 comments

Comments

@AshleyZhao
Copy link

AshleyZhao commented Nov 30, 2017

Description

Trying to run this code in the Jupyter notebook superposition_and_entanglement:

import sys
if sys.version_info < (3,5):
    raise Exception('Please use Python version 3.5 or greater.')
    
from qiskit import QuantumProgram
import Qconfig

Gives the following error:

ImportErrorTraceback (most recent call last)
<ipython-input-2-770624e829f1> in <module>()
      5 
      6 from qiskit import QuantumProgram
----> 7 import Qconfig

ImportError: No module named 'Qconfig'

Already added these code following the Readme before the cell where the error occurs:

!conda create -y -n QISKitenv python=3 pip scipy
!source activate QISKitenv
!pip install qiskit
APItoken = '<hidden>'
config = {'url': 'https://quantumexperience.ng.bluemix.net/api'}

if 'APItoken' not in locals():
    raise Exception('Please set up your access token. See Qconfig.py.')
!conda install -y jupyter 

The first two code cells run successfully, however the last one gives me a permission-denied error to write:

CondaIOError: Missing write permissions in: /usr/local/src/conda3_runtime/4.1.1
#
# You don't appear to have the necessary permissions to install packages
# into the install area '/usr/local/src/conda3_runtime/4.1.1'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone="/usr/local/src/conda3_runtime/4.1.1"

And Qconfig is still not found.

Your Environment

  • Tutorial branch (stable/master): master, getting_started.ipynb, superposition_and_entanglement.ipynb, entanglement_revisited.ipynb
  • QISKit SDK version: Unknown at the moment, probably most recent as it was just downloaded
  • Python version: 3.5
@hellmersjl3ds
Copy link
Contributor

I don't know if this is the "right way" to resolve this issue or not, but I usually use a Qconfig.py from my qiskit-sdk-py folder. If you don't have that file, you'll need modify Qconfig.py.default from the qiskit-sdk-py repository with your API Token from the Quantum Experience and copy as Qconfig.py to your qiskit-tutorial folder.

It seems like there should be a better way to do this, but that's how I do it.

@diego-plan9
Copy link
Member

@AshleyZhao, do you have a Qconfig.py on the root folder of your repository? After reading the description of the issue, I'm still not sure it is the case - as @hellmersjl3ds mentioned, the right way is indeed to create a Qconfig.py file that contains your details from Quantum Experience. Could you please check step 4 of https://github.com/QISKit/qiskit-tutorial#1-install-the-qiskit-sdk ?

Already added these code following the Readme before the cell where the error occurs:

As a side note, the README assumes the commands are executed in a regular prompt (ie. not inside a notebook) unless otherwise noted - this way you do not need to modify the notebooks themselves, and reduces the chances of running into permission issues as the one you described. If the problems persists, could you try running the installation steps on a shell?

@rraymondhp
Copy link
Contributor

Hi,
I have added the steps to install Qconfig.py here:
https://github.com/QISKit/qiskit-tutorial/blob/stable/README.rst

Also, you can find an example of the config file here:
https://github.com/QISKit/qiskit-tutorial/blob/stable/1_introduction/example_Qconfig.py

Hope this helps.

@ghost
Copy link

ghost commented Sep 11, 2018

I am working in Anaconda in spyder editor .
Can anyone tell me how to install qiskit in spyder?

@quantumjim
Copy link
Member

Thanks for your question. Someone will be happy to help, but it will be best to take your query to either the Qiskit Slack or the Quantum Computing Stack Exchange.

@ghost
Copy link

ghost commented Sep 11, 2018 via email

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

No branches or pull requests

5 participants