Please make sure that you have access to a UQCloud endpoint.
To do so, navigate to the "Profile" section and below the section "UQCloud access", note the endpoint URL and your personal access Token.
Those are necessary for UQ[py]Lab to successfully perform UQ computations on the cloud.
During this beta testing phase, the UQ[py]Lab package is hosted on a private PyPi server.
To install the package in your local Python environment, execute the following command:
xxxxxxxxxxpip install uqpylabNotes:
The following minimal example can be used to quickly test UQ[py]Lab after installation.
Create a new python script, say draw_samples.py and add the following contents:
xxxxxxxxxxfrom uqpylab import sessionsmyToken = 'your token here' # The user's token to access the UQCloud APIUQCloud_instance = 'https://XXXX.uq-cloud.io' # The UQCloud instance to use# Start the sessionmySession = sessions.cloud(host=UQCloud_instance, token=myToken)# (Optional) Get a convenient handle to the command line interfaceuq = mySession.cli# Reset the sessionmySession.reset()# Specify the options for a bivariate normal random vectorInputOpts = { 'Marginals': [ { 'Type': 'Gaussian', 'Parameters': [0,1] }, { 'Type': 'Gaussian', 'Parameters': [0,1] } ]}# Create the bivariate normal random vectormyInput = uq.createInput(InputOpts)# Draw 10 samples from the bivariate normal distributiontheSamples = uq.getSample(myInput, 10)Notice that in the quick start example one has to explicitly specify the UQCloud endpoint URL and their token in order to gain access to the UQCloud API. You can follow the steps below to store your credentials locally and simplify the UQCloud session starting process in your python scripts.
Start an interactive python session
xxxxxxxxxxpython -iImport sessions from the uqpylab package:
xxxxxxxxxxfrom uqpylab import sessionsStart a new UQCloud session using the standard procedure:
xxxxxxxxxxmySession = sessions.cloud(host="the instance URL", token="your token")Make sure that your session has successfully started, i.e. your credentials are correct. Then execute the following command to store your credentials locally:
xxxxxxxxxxmySession.save_config()You are all set! From now on, you can start a new UQCloud session in any of your scripts by simply executing:
xxxxxxxxxxmySession = sessions.cloud()Your credentials will be stored within a directory in your user's home that depends on your operating system. The actual path that they are stored is reported after calling the save_config() function.
Some users may experience the following error when they try to start a new session:
xxxxxxxxxxURLError: verify failed: certificate has expired (_ssl.c:1123)The underlying cause is rather operating system related and this error is typically appearing and disappearing as the operating system updates. The following workaround can be used to bypass this error:
xxxxxxxxxxfrom uqpylab import sessionsmyToken = 'your token here' # The user's token to access the UQCloud APIUQCloud_instance = 'https://XXXX.uq-cloud.io' # The UQCloud instance to use# Start the sessionmySession = sessions.cloud(host=UQCloud_instance, token=myToken, strict_ssl=False)Notice that the difference compared to the standard way of starting a new session is that we set the flag strict_ssl to False . This will bypass the SSL certificate validation steps that are taking place during connection. This is done by disabling the host's SSL certificate check while using the urllib.request library, which is handling all calls to the UQCloud API.
Note: Please make sure that you understand the potential risks of resorting to this workaround before using it!