Cannot find reference '_siftdown' in 'heapq.pyi' - python-3.x

I cannot find anyone with the same problem here on stackoverflow.
I have imported heapq and I am trying to do heapq._siftup() but it says it cannot find the reference to it?
I know I'm doing it right because I am following a solution to a problem, why is it giving me an error?
My interpreter is python 3.8

Related

simple import in Python 3

I've read PEP 328 and similar questions like this, but they still didn't answer my questions about python 3 import. My question is:
why does a single dot . relative import ever produce an error like the following?
code: (__init__.py exists in the same directory)
from . import module_x
error:
ImportError: attempted relative import with no known parent package
Yes, there are workarounds to get around of this error for example by running python -m from the parent directory, but why?
Shouldn't . always refer to the same directory of the current module and the example always works as long as the module_x exists in the same directory?
Particularly PyCharm tries to run unittest test cases from the directory where the test file is, and would always fail the . import. Some may argue it's PyCharm's problem, but I think a simple import like this should really always work regardless where the interpreter runs.
There is a detailed answer here, also here. Sorry I cannot write this as a comment.

module 'vpython' has no attribute 'ModelComplexity'

this code is to import vpython
this code is to find model complexity
can anyone help me solve this problem? please?
Where in the vpython documentation does is say that there exists a ModelComplexity attribute in vpython.
http://www.glowscript.org/docs/VPythonDocs/index.html
I don't understand the question. The term "ModelComplexity" has nothing to do with VPython and does not appear in the documentation for either the visual module or the vpython module. (I did searches of both.)
Bruce

gurobi is installed but Matlab doesn't recognize it

Matlab16, Linux 16.04, Gurobi 6.5.2
I want to use Cobra toolobox on Matlab, so I installed it and Gurobi as asked too.
But when I try this code (as explain in an research article : What is FBA ? Orth, Palsson) I got an error
The code
model = readCbModel('ecoli_core_model.xml')
optimizeCbModel(model)
The error
`Error using solveCobraLP (line 107)
No solver found. call changeCobraSolver(solverName)
Error in optimizeCbModel (line 213)
solution = solveCobraLP(LPproblem);
`
In changeCobraSolver.m, it said that Gurobi is a right solver. Apparently, Matlab and Gurobi are not connected.
I added .../gurobi652/linux64/matlab to the path and I tried (as explain here http://www.gurobi.com/documentation/6.5/refman/matlab_setting_up_the_guro.html) a function. I worked.
I tried to install Gurobi Mex (here http://www.convexoptimization.com/wikimization/index.php/Gurobi_Mex:_A_MATLAB_interface_for_Gurobi) but I don't find Gurobi_mex.c
Yesterday optimizeCbModel worked but I don't know what I did and what changed.
I notice that, if I try testAll then optimizeCbModel succeed (no error at least). I think we need to do initCobraToolbox first.
Make sure you are in CobraToolbox folder in MATLAB directory first. Call initCobraToolbox
changeCobraSolver ('gurobi', 'all')
Both read and optimize functions should be able to be used now.
You may find it easier to use .mat files for input model. These can be found under cobratoolbox --> test --> models --> mat
Hope this helps

How to fix unresolved imports?

I realise this is a total newbie question, but I can't seem to find an answer in the docs (poor google-fu I guess). It's my first time trying Rust and I can't figure out how to fix an unresolved import?
Currently I'm doing this in the code:
use std::io::net::ip::SocketAddr;
And getting this error:
unresolved import `std::io::net::ip::SocketAddr`. Could not find `net` in `std::io`
What am I missing? Do I need to add a dependency in Cargo.toml or something?
You need to read the docs and figure out where that type is defined.
Visit the documentation for the standard library
Enter SocketAddr in the search box
Click on the correct result
Note that SocketAddr is under std::net::SocketAddr.
The net package is actually an adjacent package to io
You need:
std::net::SocketAddr;
(see the api)
instead of
std::io::net ...

building opengm with python3

Hi I'm trying to build opengm with python3, which is allegedly supported. Crosspost to opengm forum here. The reason I ask is that I get an error on "PyInt_FromLong" which is according to this article something that shouldn't come up when porting a c library like opengm to python3. When I changed this to PyLong_FromLong, I ran into another compilation problem down the line from numpy.core.multiarray. Also note that it builds (with the appropriate ccmake options) with Python2 just fine.
My questions are:
1. Has anyone actually successfully build this?
2. Can anyone shed some light as to whether this is something on my end or theirs?
Thanks,
Chris

Resources