# Cannot write_image with orca

Hello everybody,

I am unable to export any image from plotly since:

The orca executable is required in order to export figures as static images,
but the executable that was found at ‘C:\Program Files\orca\orca.EXE’
does not seem to be a valid plotly orca executable. Please refer to the end of
this message for details on what went wrong.

If you haven’t installed orca yet, you can do so using conda as follows:

$conda install -c plotly plotly-orca  Alternatively, see other installation methods in the orca project README … After installation is complete, no further configuration should be needed. If you have installed orca, then for some reason plotly.py was unable to locate it. In this case, set the plotly.io.orca.config.executable property to the full path of your orca executable. For example: >>> plotly.io.orca.config.executable = '/path/to/orca'  After updating this executable property, try the export operation again. If it is successful then you may want to save this configuration so that it will be applied automatically in future sessions. You can do this as follows: >>> plotly.io.orca.config.save()  If you’re still having trouble, feel free to ask for help on the forums at …. Here is the error that was returned by the command$ C:\Program Files\orca\orca.EXE --help

[Return code: 1]

Orca returned code 1 because I have killed the Orca process using the task manager.

I have this kind of problem only when running the script on a Windows Server 2016 machine trought an asp.net core application.
The same application and scripts works fine on my machine but not on the server.

I’ve installed python, plotly and all the dependencies on the server using pip but I’ve installed Orca using the Windows installation in github a and added the folder that contains orca.exe to the PATH environment variable.

So when my asp.net core application calls the python script on the task manager Python process is created, after a few seconds orca process is created, but it seems to do nothing.
When I kill Orca.exe proccess I recieve the error message above.
But If I lunch the script uscing the command prompt everything works fine.
Any suggestion?

Thank you very much.

Furthermore I have created the exe file of the script using pyinstaller. When I execute the file then the error is:
For some reason plotly.py was unable to communicate with the
local orca server process, even though the server process seems to be running.

Please review the process and connection information below:

## orca status

state: running
executable: C:\Users\uname\AppData\Roaming\npm\orca.CMD
version: 1.2.1
port: 57721
pid: 15196
command: ['C:\\Users\\uname\\AppData\\Roaming\\npm\\orca.CMD', 'serve', '-p', '57721', '--plotly', 'C:\\Development\\Python\\SaveImage\\compiled\\dist\\myimage\\plotly\\package_data\\plotly.min.js', '--graph-only', '--mathjax', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js']


This happens on my machine and on the server…

Hi @rojasjo,

One thing that might be helpful is to manually run the orca serve command from the windows command prompt on the server, and add the --debug flag. The orca.status operation shows the command arguments that were used. e.g.

command: ['C:\\Users\\uname\\AppData\\Roaming\\npm\\orca.CMD', 'serve', '-p', '57721', '--plotly', 'C:\\Development\\Python\\SaveImage\\compiled\\dist\\myimage\\plotly\\package_data\\plotly.min.js', '--graph-only', '--mathjax', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js']


So you’d want something like

C:\Users\uname\AppData\Roaming\npm\orca.CMD serve -p 57721 --plotly C:\Development\Python\SaveImage\compiled\dist\myimage\plotly\package_data\plotly.min.js --graph-only --mathjax https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js --debug


The hope is that the --debug flag will produce some useful output to help us figure out what’s going wrong.

-Jon

Hello @jmmease,

I have executed the command you kindly wrote for me, the result is:

Spinning up server with pid: 19224
{“severity”:“ERROR”,“textPayload”:“Error: Provided path to plotly.js bundle does not exist and does not correspond to a release version”}

But now I understand that my Python exe has somewhere the link to orca as my workstation and not the path where orca is installed beacuse when I execute it on the server from the command prompt:
‘C:\Users\uname\AppData\Roaming\npm\orca.CMD’ is not recognized as an internal or external command, operable program or batch file.

Change the path to orca.exe then I recieve the same error:
C:\Program Files\orca>orca.exe serve -p 57721 --plotly C:\Development\Python\SaveImage\compiled\dist\myimage\plotly\package_data\plotly.min.js --graph-only --mathjax …://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js --debug

C:\Program Files\orca>
Spinning up server with pid: 8416
{“severity”:“ERROR”,“textPayload”:“Error: Provided path to plotly.js bundle does not exist and does not correspond to a release version”}

Now I understand that in the folder where I have the exe file generated by pyinstaller there is not such folder plotly…I i put plotly.min.js still I get the same error:

C:\Program Files\orca>orca.exe serve -p 57721 --plotly Pathto\plotly\package_data\plotly.min.js --graph-only --mathjax …://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js --debug
C:\Program Files\orca>
Spinning up server with pid: 9552
{“severity”:“ERROR”,“textPayload”:“Error: Provided path to plotly.js bundle does not exist and does not correspond to a release version”}

But if I execute orca without passing the path to plotly.min.js then it seems to work:
C:\Program Files\orca>orca.exe serve -p 57721 --plotly --graph-only --mathjax …://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js --debug

C:\Program Files\orca>
Spinning up server with pid: 2400
created index-f4e314c0-5cd4-4d24-9879-e2d3ba1e648d.html for plotly-graph component
Listening on port 57721 after a 4627.316088 ms bootup
Open routes: /

Now the big question, are you awere where I can change this command when generating the exe file from the Python script or if I can change this command even afert have compiled the program?

Thank you very much for your assistance.

Looking in the plotly site I found how to see orca configuration:

## orca configuration

executable: orca
port: None
timeout: None
default_width: None
default_height: None
default_scale: 1
default_format: png
mathjax: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js
topojson: None
mapbox_access_token: None


## constants

plotlyjs: /Users/jmmease/Plotly/repos/plotly.py/plotly/package_data/plotly.min.js
config_file: /Users/jmmease/.plotly/.orca


The problem is that on Windows there is not such file, I mean C:/Users/username/.plotly doesn’t exists… not on my workstation either on the server.

Thank you again.

Hi @rojasjo,

This is very helpful information. plotly.py directs orca to use the version of plotly.js (the JavaScript library) that comes bundled with plotly.py. This is located in the package_data directory under the top-level plotly package directory. I’m not very familiar with PyInstaller, but is there a way to make sure that package data is included in the resulting installed application?

What output do you get if you run the following from within your compiled application?

import plotly.io as pio
print(pio.orca.config.plotlyjs)


The question is, is there anything you can do in the PyInstaller configuration to make sure the plotly.js bundle shows up at this location.

Unfortunately, the pio.orca.config.plotlyjs path is read-only so you can’t change the path in the public API. But I’m open to making this more configurable if we come up with a better workflow for use inside PyInstaller. If you want to play around with changing the path, you can do so in the following private/unstable way:

import plotly.io as pio
pio.orca.config._constants['plotlyjs']  = new_plotlyjs


If internet access is available then you could set this to the string 'latest' to tell orca to load the latest stable version of plotly.js from the online CDN.

The C:/Users/username/.plotly directory is optional, so that fact that it’s missing shouldn’t be a problem in itself.

Hope that helps,
-Jon

Hi All,

Can anyone share an example on setting below confing

plotly.io.orca.config.executable = '/path/to/orca'


If I want to use Orca to generate static images on Windows box do I need to install Python? Is there any example of how to use Orca with Plotly on Windows box? This is the critical part of a project I am working on.

Thanks