1

How can I start a simple .py in Ubuntu Core 16 and Raspberry Pi? because I'm sitting since 10 hours to get a simple python file running.

What I tried:

Set it up with snap classic and sudo apt-get:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6

Result: No command name "add-apt-repository" exist

Next try, setting up docker snap and write a startup program for docker and your python file:

I load the Sourcecode with the docker file from Git into my raspberry and first connect docker to docker:home with the command:

sudo snap connect docker:home

after connecting it I navigate to the folder with the Project and the Dockerfile in it and try to run the file with the line from the doc:

docker build -t pythonproject

with the result: "docker build" requires exactly 1 argument.

I also tried it the normal way with docker run:

docker run docker_file_name

Result:

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.38/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

So have someone an Idea how to run a simple python project on Ubuntu Core 16?

Because at the moment I don't know any reason why to use Ubuntu Core 16 when no tutorial is working and a single python project can't be run after 10 hours on working...

1

I found a way that can't possible be the right way, but it does get you to the end result you want. If you follow this tutorial to create a snap and include python as a part plugin, it will install python as it install the local snap.

I created a hello world git repository, then did that procedure using my hello world repository as the source. The snap that was created was worthless, but it did install python!

Now which python returns /usr/bin/python and I can use it to run files I create locally.

Aside, I think the right way is to to install from source to use it in a development environment or install it as a plugin with your code as a snap for a production thing, as noted in the answer in the comments. But those ways seem harder than this cheater route.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.