-
Notifications
You must be signed in to change notification settings - Fork 748
Using pythonnet in docker container #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
I am using the last master, when I install pythonnet using pip+git, right? |
yes, pip+git should get you the latest. but you should also add -U and
--force flags to force update the package.
…On Wed, Dec 7, 2016 at 5:53 PM, Alexandre Catarino ***@***.*** > wrote:
I am using the last master, when I install pythonnet using pip+git, right?
pip install git+https://github.com/pythonnet/pythonnet
Let me try mono 4.2.44! Thanks.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#303 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgZ5a9TL9fAkOxM8hnryXmZn4R3pDP7ks5rF0b5gaJpZM4LHQPR>
.
|
I apologize, WinForms is available on Mono, but I have not tested this: |
From my base image:
However, when I ran the example of embedding Python in .NET from pythonnet README, I got the same exception described above. |
@denfromufa any thoughts on how to fix this? Its blocking using Python.Net in our platform / https://github.com/QuantConnect/Lean (It works fine in windows) |
I have similar issues with embedding CPython using pythonnet on Linux:
#245
Scroll to bottom of the issue.
I will try more, but I do have expertise on how Python works on Linux,
particularly dlopen behavior. I got it working in the past, but somehow it
broke again.
Perhaps posting on mailing list or SO will get more useful suggestions.
Also some pythonnet developers are more knowledgeable about Linux than me.
On Tue, Dec 20, 2016, 5:34 PM Jared <notifications@github.com> wrote:
@denfromufa <https://github.com/denfromufa> any thoughts on how to fix
this? Its blocking using Python.Net in our platform /
https://github.com/QuantConnect/Lean (It works fine in windows)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#303 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgZ5fqEe1ltWR_Lah0oXB1BoEMZ3rB8ks5rKGXrgaJpZM4LHQPR>
.
|
QuantConnect/Lean is able to support python in Linux with pythonnet! In order to do it, we needed to discarded changes made by #300. Since However, if we get
Files: // test.cs
namespace TEST
{
using System;
using System.IO;
using Python.Runtime;
class TEST
{
public static void Main(string[] args)
{
Environment.SetEnvironmentVariable("PYTHONPATH", Environment.CurrentDirectory);
PythonEngine.Initialize();
try
{
using (Py.GIL())
{
dynamic clrModule = Py.Import("pytest");
clrModule.print_now();
}
}
finally
{
PythonEngine.Shutdown();
}
}
}
} # pytest.py
import clr
import numpy as np
clr.AddReference("System")
import System
def print_now():
print System.DateTime.Now, np.pi |
@AlexCatarino this is good finding! would you mind putting a pull request for this? |
I thought that you fixed both embedding and extending pythonnet?
What compilation flag do you mean?
…On Thu, Jan 5, 2017, 7:21 PM Alexandre Catarino ***@***.***> wrote:
My "fix" is basically to undo #300
<#300>. It would break what
#300 <#300> fixes...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#303 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgZ5RWW1vxZ9qSDNnR8bj8OAp3ZlSmHks5rPZcLgaJpZM4LHQPR>
.
|
@AlexCatarino @jaredbroad I can confirm your problem and this is also affecting our testing on Travis CI. Let me look for solutions. The worst we may have to do is to recompile CPython with the correct flags or find Python dsitribution that uses these settings. |
@AlexCatarino @jaredbroad I tried Miniconda 3.5 64bit on Linux and it works in both directions - embedding and extending pythonnet! Can you use Miniconda or Anaconda in your docker images? |
@denfromufa I think this item from the old
|
so @vmuriart found a solution to this problem that works with system python, no miniconda necessary: |
@AlexCatarino were you able to resolve your issue? There's a couple docker images/recipes on https://hub.docker.com/r/pythonnet/pythonnet/tags/ |
We have resolved our issue and will keep an eye on those images/recipes. |
Hello gents, I need help with python3.6... Thank you so much for sharing the conversation. I am trying to run this with Miniconda 3.6 but I get the following error: Building the docker: RUN ln -s /lib/x86_64-linux-gnu/libdl.so.2 libdl.so python -V works and give me 3.6.4 as expected. PS: Miniconda 2.7 doesn't work either.... Any ideas of how to make work? I need anything that makes python3.6 work... |
Ok, I found a clue, the problem seems to be specific to how Anaconda is installed on a Debian/Stretch Docker. Anaconda doesn't work for me neither 2 or 3..... |
We are trying to support algorithms written in python in QuantConnect/Lean (which is written in C#).
So far, we were able to accomplish that locally in Windows. However, we have to make it work in a docker container in order to launch algorithms in our servers, but we could't make pythonnet work in that environment.
Here are the steps we are following:
docker run -it quantconnect/lean:foundation /bin/bash
pip install git+https://github.com/pythonnet/pythonnet
After that, we ran the three winforms demos. All throw the same exception:
Finally, we ran the example of embedding Python in .NET from pythonnet README:
mcs /reference:Python.Runtime.dll test.cs && mono test.exe
that yields the following exception:
The text was updated successfully, but these errors were encountered: