Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13921

VSCode autocomplete / hints not working for PySCIPopt (installed in conda env)

$
0
0

The problem:

VSCode is not showing me hints or autocomplete options for methods of objects from the pyscipopt library.

Minimal working example:To test that pysciopt is correctly installed, I wrote and ran following code:

from pyscipopt import Modelm = Model("test")m.addVar()m.printStatistics()

VSCode let me autocomplete "pyscipopt" and "Model" on the first line, as well as "Model" on the second line. However, it gave me no hints on 3rd and 4th line.

I ran the file via the "run python file" icon in upper right of the VSCode window, and it produced following output in the terminal:

SCIP Status        : problem creation / modificationTotal Time         :       0.00  reading          :       0.00Original Problem   :  Problem name     : test  Variables        : 1 (0 binary, 0 integer, 0 implicit integer, 1 continuous)  Constraints      : 0 initial, 0 maximal  Objective        : minimize, 0 non-zeros (abs.min = 1e+20, abs.max = -1e+20)

Therefore, pyscipopt seems to be correctly installed and accessible to my python interpreter.

Extra details

I'm on windows 10.

I began by installing the miniforge anaconda env. manager. Then I created a new environment named SCIPopt, activated it, and then I installed the library by typing

conda install --channel conda-forge pyscipopt

I restarted VSCode and set "Python 3.12.2 ('SCIPopt') ~\miniforge-pypy3\envs\SCIPopt\python.exe" as my python interpreter. Before I had done that, running the minimal working example resulted in an error (no module named pyscipopt).

I also tried adding a settings.json file to my workspace with following contents:

{"python.pythonPath": "C:\\Users\\{my user name}\\miniforge-pypy3\\envs\\SCIPopt"}

but that did not help.

When I mouse over the 'addVar()' method in the example, VSCode shows me the following hint: "(function) addVar : Any". Similarly with the other method I call.

When I right-click the "Model()" bit of code or one of the methods and select 'go to definition', I get a message saying 'no definition found for...'.

I also tried launching VSCode from the miniforge prompt with the SCIPopt environment activated, but that didn't help either.


Viewing all articles
Browse latest Browse all 13921

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>