SCIP Python Installation Issue Windows with pip - scip

Hello community / developers,
I am currently trying to install SCIP with python and found that there is Windows Support and a pip installer based on https://github.com/SCIP-Interfaces/PySCIPOpt/blob/master/INSTALL.md.
Nevertheless I run into a problem "Cannot open include file"
Below is a list of the things I performed to get to this step.
Download Python Anaconda 2.7 64 bit
Install with all checkboxes as they are
Download PyCharm Community edition
Click 64 bit desktop link, and associate with .py checkboxes
Open CMD > write: easy_install -U pip
Download Visual C++ Compiler for Python 2.7
Setup folder structure and downloaded header files
CMD > pip install pyscipopt leads to error:
C:\Users\UserName\Downloads\SCIPOPTDIR\include\scip/def.h(32) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
error: command 'C:\Users\UserName\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2
My environment variables and folder directory can be found here:
http://imgur.com/a/mJRva
Help is very much appreciated,
Kind regards

The error message says your missing "stdint.h". This is because you don't have a recent Visual Studio version. You probably use the one that came with your Python installation. Try installing the latest Visual Studio to fix this issue.
You might want to look at this question:
Why Microsoft Visual Studio cannot find <stdint.h>?
PySCIPOpt needs a C/C++ linker to build the Python module - although it's already precompiled on PyPI.

Alright, I figured it out. I needed to
(1) Install Python 3.6 instead of Python 2.7 (both Anaconda)
(2) Afterwards pip installation worked
(3) I moved the library files in the lib folder
(4) Now I can execute the examples.
Interestingly, I get an unresolved reference error although the code works fine (I assume this is a bug of Pycharm/scipy?) Link to picture: https://www.dropbox.com/s/d8pf6dkwuz9cwto/scip_python.png?dl=0

Related

OSError: WinError 193 %1 is not a valid Win32 application

I have been working on a project in Visual Studio Code with Python 3.8.5, and I have a windows 64 bit operating system. I decided to upgrade to Python 3.11.1, and downloaded the official 64 bit installer and followed the instructions. All the packages I import at the beginning of my project that were previously working now give this error "[WinError 193] %1 is not a valid Win32 application" when I run the import statements for them.
For some of the packages (pandas, numpy, matploblib) this was solved by using an approach I saw on a few similar questions to this, by opening the command prompt and typing "pip uninstall pandas" etc and then doing "pip install pandas".
However, for the other packages (sklearn, umap, nltk), this isn't working even after trying that process a few times. I've also tried updating pip. Does anybody have any ideas on what could be causing this to work for some packages but not for others? It allows me to install all of the packages via the command prompt, the issue only arises when I actually try and import them via VSCode, and it's the same error for every package. I've seen some suggestions saying to ensure the environment path is clean, but I'm still quite a beginner so I'm a bit unsure as to what that means.
Any help would be really appreciated.

Import pandas could not be resolved from source Pylance(reportMissingModuleSource)

I've been trying to use the packages pandas, numpy, matplotlib, seaborn in my "Visual Studio Code", but the program keeps showing me the following message:
"import pandas could not be resolved from source Pylance(reportMissingModuleSource)"
Previously to Visual Studio Code I installed "Anaconda" to use Jupyter, and now it says that i have the existing packages (pandas, numpy...) but keeps appearing this message that doesn't allow me to use pandas in my Visual Studio.
Anyone could help me to solve this issue?
I tried installing again all the packages to check if they didn't exist but apparently are installed all of them but in another route. I can't find how is the way to put them so the Visual Studio Code recognizes them and I can use them.
I also received similar an error on my IDE VSCode and currently using mac m1 .First we need to make sure that the python3 interpreter version from terminal version is the same with our python version selection in VSCode.
open terminal.
type 'python3'
then you will see your python version.(my python3 version is 3.9.12)
python3 version
open your IDE VSCode
open any/current folder that related to python project on IDE VSCode
Check your python version at the bottom right on IDE VSCode (in my case the python version is 3.10.64)
change or switch VSCode python version from 3.10.64 to 3.9.12 (same with your python version on your pc)
done
I also had this problem and it was because of version mismatches.
I had installed Python AND Anaconda. If anyone else has done this and gets this error, you need to uninstall both. Then install Anaconda only; Python (the compatible version) is installed as part of that process.
See https://docs.anaconda.com/anaconda/install/windows/
Also, you can click on the interpreter version at the bottom left corner of the screen (Vs.code 2022) it should show a dropdown menu with a list of the available and selected python interpreter. Click on add interpreter path and paste the path to the python interpreter with all the required modules installed and click enter. This should resolve the problem.
I re-entered the path to Python interpreter and warning disappeared. Hope that helps you.
Another way I solved this issue having followed every other installation process to the letter was deactivating Pylance. Works a (py)charm now.
I encountered this problem in VSCode under remote to WSL2 of Windows 10. The Python version is correct as interpreter (3.9.13) and the terminal in VSCode is also under the same envs (ie. VSCode ran "conda activate xx" and (xx) is shown in prompt)
Originally, I tried to install the pandas by the following command.
sudo apt-get install python3-pandas
Pandas was installed successfully as stated in the terminal but the problem is still there.
When I try to install pandas by the following command, the problem solved.
pip install pandas

PyCharm 2018.2.4 and Anaconda 5.3.0

Mine is Anaconda 5.3.0
When I run .py in PyCharm 2018.2.4, why it shows that:
ImportError:
DLL load failed: The specified module could not be found.
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
It seems that PyCharm 2018.2.4 cannot import numpy??
Does anyone see this problem too? How to fix it? Thank you very much.
You can set the Python interpreter path on PyCharm to the Anaconda one (something like ~/anaconda3/bin/python).
Todo do so, open the Settings dialog >> Project: [ProjName] in the left panel >> Project Interpreter. Now you can add to the list paths to local Python interpreters, or virtual environments in the project folder or in a folder specified in the WORKON_HOME.
More instructions here and here.
I believe I have useful information if not the solution.
I too received the error using python to import numpy from the windows command prompt. Then I realized I could succeed if I used the Anaconda prompt. Curious about the difference, I exited python and examined the PATH environment variable. As I had hoped, it contained Anaconda references that did not exist in the Windows PATH. At the command prompt I typed: path > p.txt and hit enter to create a file since the string was so long. When I opened the file in notepad I copied the Anaconda references to the clipboard (C:\Users\laptop\Anaconda3;C:\Users\laptop\Anaconda3\Library\mingw-w64\bin;C:\Users\laptop\Anaconda3\Library\usr\bin;C:\Users\laptop\Anaconda3\Library\bin;C:\Users\laptop\Anaconda3\Scripts;C:\Users\laptop\Anaconda3\bin;) then used the Advanced Settings under the System Control Panel to Edit the Environment Variable and paste it on the beginning of PATH. The problem seems to have gone away, both in the Windows shell and in Pycharm.
First, try to delete .git file from project folder and re-enable vcs. Then uninstall numpy by:
pip3 uninstall numpy
After that, go to pycharm and open File > settings > Project Intepreter get the python location url ex: usr/bin/python3. Copy that path and open terminal and type:
usr/bin/python3 install numpy. Wait for pycharm indexing and try to run project again
I don't think it's an issue with PyCharm.
I got Anaconda 5.3 today and use PyCharm Pro 2018.2.4. Unfortunately, I got the same error as you do. However, if you go to powershell (if you are on Windows like me), type in python and import numpy you still got the same error.
Not sure why yet but uninstall & reinstall didn't help (and tbh I don't get why this might help in any sense though).
So my current solution is:
Roll back to Anaconda 5.2 with Python 3.6 and everything gets back to working.
I have the same thing, pychrm 2018.2 & Anaconda3 (64-bit) 5.3 on win10
I think the issue is about Anaconda, I have uninstalled the Anaconda 5.3 and installed Anaconda 5.2, then everything is ok

Install pymssql 2.1.3 in Pycharm

I'm working with Pycharm in a project to read SQL DBs ,I'm working in a windows 10 64bits workstation and I'm trying to install the module pymssql, I have already installed VS2015 to get all requirements but now each time that i try to install i got the message:
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2
I saw on message details the error in:
_mssql.c(266): fatal error C1083: Cannot open include file: 'sqlfront.h': No such file or directory
How can i figured it out? thanks
Seems that your error is a known problem, check here.
As you can see from the last post from the link, they don't have wheels built for Python3.6, so when you try to install pymssql, the error is raised.
Still, as the post found suggests, you can try the following options:
Drop back to Python 3.5
Use the Python 3.6 wheels available here:
Try to build pymssql using the advice given in the forum link above.
If you were trying to install pymssql directly from PyCharm, I think that you should follow the options showed above but from command line
For anyone that is seeing this in 2021, pymssql only supports python 3.7 according to their own build files. Don't bother trying to use it if you are on 3.8 or higher. I'm on 3.9.1
Use pyodbc instead. This install worked right out of the box using windows server 2016 after spending about 3 hours of digging.
pip install pyodbc
hope that saves you a ton of grief...
I had the same problem and I fixed this way.
Download pymssql module from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql. place the .whl file in the C:\Python38-32 folder.
Open cmd.exe
Run
cd C:\Python38-32
pip install pymssql-2.1.4-cp38-cp38-win32.whl
I had a same problem but its fixed this way.
Copied "rc.exe" and "rcdll.dll" from "C:\Program Files (x86)\Windows Kits\8.1\bin\x86"
Pasted "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin"
In my case helped me rollback to Python 3.8. Same problem I had on 3.10 x64

ValueError: Symbol table not found

I'm trying to install scikit-learn; following the instructions, I downloaded the source and attempted to install it with python setup.py install, however the installation is interrupted at:
File "C:\Users\Alpine\Anaconda\lib\site-packages\numpy\distutils\mingw32ccompi
ler.py", line 278, in generate_def
raise ValueError("Symbol table not found")
ValueError: Symbol table not found
I've also tried using easy_install -U scikit-learn, although end up with the same error.
Using conda install scikit-learn appeared to install the conda-3.4.1-py27_0.tar.bz2 and numpy-1.8.1-py27_0.tar.bz2 packages, and for safe measure I ran conda update anaconda, although I'm still receiving the same error.
Would anybody know how to work around this?
This solution will take care of "symbol table not found" error from numpy (or any other package ) on windows machine
sklearn people have provided good solution for this over here
http://scikit-learn.org/stable/developers/advanced_installation.html#building-on-windows
you can find instruction for Linux and mac on same page
now just follow these steps
32-bit Python
For 32-bit python it is possible use the standalone installers for microsoft visual c++ express 2008 for Python 2 or Microsoft Visual C++ Express 2010 for Python 3.
Once installed you should be able to build scikit-learn without any particular configuration by running the following command in the scikit-learn folder:
python setup.py install
64-bit Python
For the 64-bit architecture, you either need the full Visual Studio or the free Windows SDKs that can be downloaded from the links below.
The Windows SDKs include the MSVC compilers both for 32 and 64-bit architectures. They come as a GRMSDKX_EN_DVD.iso file that can be mounted as a new drive with a setup.exe installer in it.
**For Python 2 you need SDK v7.0: MS Windows SDK for Windows 7 and .NET Framework 3.5 SP1 -> https://www.microsoft.com/en-us/download/details.aspx?id=18950
For Python 3 you need SDK v7.1: MS Windows SDK for Windows 7 and .NET Framework 4** -> (can't post link as i need atleast 10 reputation point )
Both SDKs can be installed in parallel on the same host. To use the Windows SDKs, you need to setup the environment of a cmd console launched with the following flags (at least for SDK v7.0):
cmd /E:ON /V:ON /K
Then configure the build environment with:
SET DISTUTILS_USE_SDK=1
SET MSSdk=1
"C:\Program Files\Microsoft SDKs\Windows\v7.0\Setup\WindowsSdkVer.exe" -q -version:v7.0
"C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.cmd" /x64 /release
after typing above commands in cmd as soon as you hit enter the window will be changed lil bit ( font color changed to green ) now go to directory where you have downloaded sklearn zip file from git hub then un-zip it
and go to directory where you can find setup.py
run command
python setup.py install
if it's not recognizing python then you migh have missed this command
cmd /E:ON /V:ON /K
so till now if u have done everything correct then your package will be installed without any difficulties