I am trying to use Sage on a mac and am not particularly computer savvy (e.g. I still haven't figured out what I am meant to do with PATH and find the installation documentation a bit forbidding). I am running sage from the command line from a particular folder which contains a file "test.sage" but when I put 'load("test.sage")' I get the following error message:
TypeError Traceback (most recent call last)
in ()
----> 1 load("test.sage")
/Applications/SageMath/src/sage/structure/sage_object.pyx in sage.structure.sage_object.load (/Applications/SageMath/src/build/cythonized/sage/structure/sage_object.c:11186)()
if sage.repl.load.is_loadable_filename(filename):
sage.repl.load.load(filename, globals())
return
/Applications/SageMath/local/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
if attach:
add_attached_file(fpath)
exec(preparse_file(open(fpath).read()) + "\n", globals)
elif ext == '.spyx' or ext == '.pyx':
if attach:
Error message
TypeError: expected string without null bytes"
Earlier on I was trying the same thing and getting the message:
"IOError('did not find file %r to load or attach'"
I wonder if someone could tell me what I am doing wrong or might try to fix the problem?
Related
TLDR:
await d.preview() # throws "NameError: name 'launch' is not defined"
# d.preview() # does not throw "NameError: name 'launch' is not defined"; however, it still does not produce the desired image in a jupyter notebook... It's __repr__ prints <coroutine object DashBoard.preview at 0x7f44013aaa70>`
I'm trying to preview a rapids dashboard that is correctly rendering in a separate browser window. However, when I try to preview a rasterized screengrab of the dashboard using the convenient looking plotly method, d.preview(), I keep getting this paradoxical exception, "NameError: name 'launch' is not defined".
await d.preview() works in the documentation here:
https://docs.rapids.ai/api/cuxfilter/stable/themes/Themes.html
I am running rapids21.08 in python3.7 on ubuntu (Pop!_OS 20.10) using an RTX2080 GPU using a jupyter notebook with the default jupyter theme made using $ jt -r, and I am not using any matplotlib funny business. I have run the very common import matplotlib.pyplot as plt command.
This seems like a really common problem which I'm surprised isn't just working... Maybe there's something obvious I'm just missing... Please help me!
The full exception can be found postscript.
Thank you for your time,
Tim
P.S.
# d = some cuxfilter.dashboard.DashBoard instance that apparently works with d.show()
await d.preview() # throws NameError: name 'launch' is not defined
throws
NameError: name 'launch' is not defined
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/tmp/ipykernel_8654/2723113380.py in async-def-wrapper()
~/anaconda3/envs/pyenv_ub/lib/python3.7/site-packages/cuxfilter/dashboard.py in preview(self)
507 port=port, websocket_origin=url, show=False, start=True
508 )
--> 509 await screengrab("http://" + url)
510 self.stop()
511
~/anaconda3/envs/pyenv_ub/lib/python3.7/site-packages/cuxfilter/assets/screengrab.py in screengrab(url)
6
7 async def screengrab(url):
----> 8 browser = await launch({"slowMo": 5}, args=["--no-sandbox"])
9 page = await browser.newPage()
10 await page.setViewport(
NameError: name 'launch' is not defined
This is probably due to the missing pyppeteer package. Installing this in the conda env should resolve the issue:
conda install -c conda-forge pyppeteer>=0.2.6
cuxfilter=21.10 won't have this issue, as the dependency has been added to it.
I recently came across AMIEGO. When I try to run the example problems (provided in the example directory) I get the following error.
-------------------------------------------------------------------------------
Exit Flag: True
Elapsed Time: 0.04829263687133789
======================ContinuousOptimization-End=======================================
+------------------------------------------------------------------------------+
| pyOptSparse Error: Received an unknown option: 'Major optimality tolerance' |
+------------------------------------------------------------------------------+
Traceback (most recent call last):
File "/home/sky/anaconda3/lib/python3.8/site-packages/openmdao/utils/concurrent.py", line 65, in concurrent_eval_lb
retval = func(*args)
File "/home/sky/anaconda3/lib/python3.8/site-packages/amiego/kriging.py", line 239, in _calculate_thetas
opt_x, opt_f, success, msg = snopt_opt(_calcll, x0, low, high, title='kriging',
File "/home/sky/anaconda3/lib/python3.8/site-packages/amiego/optimize_function.py", line 76, in snopt_opt
opt.setOption(name, value)
File "/home/sky/anaconda3/lib/python3.8/site-packages/pyoptsparse/pyOpt_optimizer.py", line 829, in setOption
raise Error("Received an unknown option: %s" % repr(name))
pyoptsparse.pyOpt_error.Error
I tested pyoptsparse optimization driver with the sellar problem and it worked as expected. So I think I'm missing something in AMIEGO. And fyi I didn't modify anything in the example, so I am running it with SLSQP(from pyoptsparse driver) for the continuous part(I dont have SNOPT). Any pointers on how to fix this or where to start looking will be helpful.
I've pushed up a couple of fixes to the repository so that you can run it without SNOPT. The basic Branin problem in the examples works and gets to the expected answer now. I can't promise that SLSQP is the best choice for more complicated problems as we usually favor SNOPT over SLSQP in our work. This is still very experimental code, so the documentation is weak and there are still a lot of control knobs and flags that are buried as subcomponent attributes (including ideas that we tried that didn't pan out). But we appreciate users who are willing to try AMIEGO and help us improve it.
I am running developmental scientific code. I am stuck on a cryptic error message, and am curious what the OpenMDAO team thinks. When I run the code in serial, it works with no issues. When I run it under mpirun, OpenMDAO throws a cryptic error message:
Traceback (most recent call last):
File "test/exampleOptimizationAEP.py", line 129, in <module>
prob['ratedPower'] = ratedPower
.....
File "/scratch/jquick/test/lib/python2.7/site-packages/openmdao-1.7.3-py2.7.egg/openmdao/core/vec_wrapper.py", line 1316, in __setitem__
(self.name, name))
AttributeError: 'params' has not been initialized, setup() must be called before 'ratedPower' can be accessed
I am not sure how to approach this. There is nothing obviously different about the ratedPower variable in the code. What information does this error give me about what is going wrong?
This is a bug in OpenMDAO <= v1.7.2. Look at the output of check_setup and see the list of parameters without associated unknowns. You will find that variable in there. When running in parallel (because of the bug), you can not set any hanging params (ones without associated unknowns) in your setup script.
The way to fix it is to add an IndepVarComp to any variable you need to initialize the value of.
I'm implementing some numerical algorithms on GPU via OpenGL and Qt.
But i am not very familiar with it.
I want to extract some functions from my current shader to some "shader library" and use it in my other shaders by string interpolation. It not hard to implement but i don't know how handle shader's compile errors
I use following code to compile shader
QOpenGLShaderProgram *shaderProgram = new QOpenGLShaderProgram();
if (!shaderProgram->addShaderFromSourceFile(QOpenGLShader::Fragment,fragmentShaderFileName)) {
qDebug() << "Failed to compile fragment shader";
//..........
When some compile error appears Qt print following message (an example)
QOpenGLShader::compile(Fragment): 0:331(9): error: syntax error, unexpected NEW_IDENTIFIER, expecting ',' or ';'
*** Problematic Fragment shader source code ***
//my shader source code
Is possible to catch error line number and use it to build my own error message? (with highlighted line)
According to the Qt documentation, you can use QOpenGLShaderProgram::log():
Returns the errors and warnings that occurred during the last link()
or addShader() with explicitly specified source code.
You can then parse the resulting string to build your own error message.
I'm running into a very weird issue. I have 1 file with certain code that is valid only in PHP5.5+ and whenever I run the jmstranslation bundle command line to extract messages I get the error saying that file (on that specific line cannot be parsed). It's very weird because I made sure that the php version I have on my machine is 5.5+ (and everything runs just fine including the phpunit tests).
The exact error I got is
[RuntimeException]
Could not parse "Processor.php": Unexpected token '=' on line 135
[PHPParser_Error]
Unexpected token '=' on line 135
The code that caused the error:
if (!empty($adjustments = $this->createAdjustments($order)))
{
// the empty check above should work in PHP 5.5+
// ...
}
Why do you assign a variable (here $adjustments) in the if test? In some cases it's useful, but in your case is it a typo, instead of the == operator ?
Did you try to perform the same operation in 2 steps?
$adjustments = $this->createAdjustments($order);
if (!empty($adjustments))
{
// the empty check above should work in PHP 5.5+
// ...
}