Only Pythonnet 2.5.2 is compatible with python 3.8.3 to python 3.8.5.

  • 20 February 2023
  • 4 replies
  • 731 views

Userlevel 4
Badge +1

 Hello,

Just like Python Version, we also have Pythonnet which is bridge between Python and .NET. I have experienced many customer queries of having compatibility issue with Python 3.8. As 3.8 is recommended Python version for connecting with ZOS API Python but still the bridge (Pythonnet) needs to be compatible with Python version. Then only we can connect and run ZOS API properly. Now a days Python editors like PyCharm, Spyder, Jupyter etc. recommending Pythonnet 3.0.1 for Python 3.8.3 to Python 3.8.5. Pythonnet 3.0.1 is not fully compatible with Python Version 3.8.3 to Python 3.8.5. If you have installed this version uninstall Pythonnet 3.0.1 and reinstall pythonnet2.5.2 Version using the command in your console.

pip install pythonnet==2.5.2

If not, you will receive the error message “Failed to initialize pythonnet”.

Thanks

Sahil


4 replies

I recommend clarifying this post. It does not make sense to talk about Python versions being compatible with other Python versions:

Python 3.0.1 is not fully compatible with Python Version 3.8.3 to Python 3.8.5.

 

What I have found is that pythonnet 2.5.2 only works with Python <= 3.8. I believe that may be the intent of OP.

Userlevel 4
Badge +1

Hello Julian,

Yes, I intended to write Pythonnet instead of Python.Sorry for the inconvenience.I made the changes as suggested.Thanks for the feedback Julian.

Regards

Sahil

Hi Julian,

you can, for example, use Anaconda as Python distribution, to use Python 3.9.16 (my current version) and pythonnet 2.5.2. It can be installed via the anaconda-prompt (conda install -c conda-forge pythonnet=2.5.2). As of now, I have not encountered any problems with it (OpticStudio 23.1).

Regards

Lucas

Userlevel 6
Badge +2

There is an interesting post here about PythonNET: 

I am reporting it to our product team.

Reply