Not able to run SCIP solver in Streamlit - pyomo

I have created a code for MINLP optimization in Pyomo using scip solver. I have created a web app using Streamlit and it is working perfectly on my local machine by pointing to the location of scipampl exe file on desktop.
opt = pyo.SolverFactory('scipampl',executable=r'scipampl.exe')
However I am getting an error while deploying the app on Streamlit cloud from GitHub.
The error message is 'Attempting to use an unavailable solver. The SolverFactory was unable to create scipampl solver.
I have already kept the solver exe in the main repository and am pointing to that location.
Do I need to add any specific dependencies in the requirements.txt or packages.txt files for running the scipampl solver?

Related

Docker cache file permission

I use py-staticmaps repository for generate static map image, In normally I run this repo via python .main.py, it is working but I use the repo in Django and docker, I have a problem with cache files,. following error. What can I do?
I build it locally al of them working normally but in server I run via docker-compose that is to be problem with cache

Why unitest for sharpdx fails on Jenkins but not localy and how can i fix it?

I have a couple off UnitTest which are running fine localy, but fail on my Jenkins-Server. All unit-test a failing with an similiar reason: SharpDX is unable to aquire resources.
SetUp : SharpDX.SharpDXException : HRESULT: [0x887A0022], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: A resource is not available at the time of the call. However, it may be available at a later date.
+++++++++++++++++++
STACK TRACE:
at SharpDX.Result.CheckError()
at SharpDX.Direct2D1.Factory.CreateHwndRenderTarget(RenderTargetProperties& renderTargetProperties, HwndRenderTargetProperties& hwndRenderTargetProperties, WindowRenderTarget hwndRenderTarget)
My Jenkins(ver. 2.190.1) is running under the local system account. The error seems to be realted to that (No screen session). I tried the solution from the answers of #maQ at Jenkins on Windows and GUI Tests without RDC and running jenkin as a local user but without success.
Have you tested running your code from command line or from IDE?
If you have not tested your code locally from command line, you can test it.
Is your build node and local machine same? If not please verify that the sharpdx is installed in your build node.
If it is already tested and working and your build node is also configured with the sharpdx, adding the environment variable point to sharpdx home directory in jenkins slave's configuration should work. All the best !

Running python executable on a target machine

Is it possible to run my python executable on target machine without the dll's?
I have used pyinstaller and it runs perfectly fine on a target machine but the problem with using pyinstaller is the size of the folder that it creates. My script uses the selenium webdriver.
Is it possible to create an extension and run it from the browser itself without the client having to download it?
if its possible then i need some hint

GhostScript in Azure

I'm in the process of moving some on-premise app to Azure and struggling with once aspect - GhostScript. We use GhostScript to convert PDF's to multi page TIFF's. At present this is deployed in an Azure VM, but it seems like a WebApp and WebJob would be a better fit - from a management point of view. In all of my testing I've been unable to get a job to run the GhostScript exe.
Has anyone been able to run GhostScript or any third party exe in a WebJob?
I have tried packaging the GhostScript exe, lib and dll into a ZIP file and then unzip to Path.GetTempPath() and then using a new System.Diagnostics.Process to run the exe with the required parameters - this didn't work - the process refused to start with an exit code of -1073741819.
Any help or suggestions would be appreciated.
We got it to work here:
Converting PDFs to Multipage Tiff files Using Azure WebJobs. The key was putting the Ghostscript assemblies in the root of the project and setting "Copy always". This is what allows them to be pushed to the Azure server, and to end up in the correct place, when you publish the project.
Also, we needed to download the file to be processed by Ghostscript to the local Azure WebJob temp directory. This is discovered by using the following code:
Environment.GetEnvironmentVariable("WEBJOBS_PATH");

Django on production server (No module named urls)

I'm setting Django on production server and have this strange error(on picture below)
As you can see pythonpath seems to be ok(first row is my project folder), I definitely have module urls.py inside my project/project folder, I have init file there and my ROOT_URLCONF = 'project.urls'(I also tried without project name, but it didn't help either).
So, that is strange why it can't find it :(
I have to say that I tried to create a new project on server and then it seems to be ok, but with this project that is copied from local server it is behaving like this.
Printscreen of error:
The only problem I can think of is the process of package creation. What process have you followed to deploy your Django application?
If you have compiled the Django application on your local machine or CI server and then deployed the compiled package then you will run into Import module issues because pyc files will contain hard coded paths of your local machine or CI servers. To fix it before compiling the python files you should create the same hierarchy on your local/CI server and then compile and deploy.
Hope this helps.
[Edit]
I agree hardcoded paths in pyc files is PITA and we have been doing this in our production environment once we discovered it.
However I do not agree with you to re generate pyc files on the server because as your application will grow and you move towards a large application it will become very slow.
You don't have to keep your development environment directory to follow production directory structure. Instead you can have any directory path on development machine and create a separate bash script which will create a package for you by creating a directory structure that you follow on production. Bash script will have the logic of
Creating a directory structure similar to production
Checking out the code from source control
Compile the code using python -m compileall .
Create a tarball
You can untar this tarball on production server and your application should run fine.
For more information about package creation in python and best practices, check out this video
It doesn't look like your project is in your path, actually. The traceback is only showing Django packages.