pythonic-emacs / anaconda-mode

Code navigation, documentation lookup and completion for Python.
GNU General Public License v3.0
707 stars 87 forks source link

Trouble running inside docker container on macOS #353

Open cjauvin opened 5 years ago

cjauvin commented 5 years ago

I have some trouble running anaconda-mode inside a docker container on macOS, I will try my best to help you reproduce my setup to figure out what might be the problem (or my mistake!).

First here are the packages I'm running:

anaconda-mode      20190111.1524
docker-tramp       20170207.325

I have also installed socat with brew:

$ socat -V
socat by Gerhard Rieger and contributors - see www.dest-unreach.org
socat version 1.7.3.2 on Jan 13 2019 04:51:51
   running on Darwin version Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64, release 18.5.0, machine x86_64

Steps:

(1) I first run a simple python container: docker run --name toto --rm -it python bash

(2) I start Emacs and then do: (setq python-shell-interpreter "/usr/local/bin/python"), which corresponds to the interpreter location in the container

(3) Then: C-x f /docker:toto:/bla.py

(4) In that new file inside the container, I simply put import logging

(5) With my cursor on the word "logging" , I then do M . (anaconda-mode-find-definitions), which doesn't work..

At this point:

Searching for jedi>=0.13.0
Reading https://pypi.org/simple/jedi/
Downloading https://files.pythonhosted.org/packages/25/2b/1f188901be099d52d7b06f4d3b7cb9f8f09692c50697b139eaf6fa2928d8/jedi-0.13.3-py2.py3-none-any.whl#sha256=2c6bcd9545c7d6440951b12b44d373479bf18123a401a52025cf98563fbd826c
Best match: jedi 0.13.3
Processing jedi-0.13.3-py2.py3-none-any.whl
Installing jedi-0.13.3-py2.py3-none-any.whl to /root/.emacs.d/anaconda-mode/0.1.13
writing requirements to /root/.emacs.d/anaconda-mode/0.1.13/jedi-0.13.3-py3.7.egg/EGG-INFO/requires.txt
Adding jedi 0.13.3 to easy-install.pth file

Installed /root/.emacs.d/anaconda-mode/0.1.13/jedi-0.13.3-py3.7.egg
Processing dependencies for jedi>=0.13.0
Searching for parso>=0.3.0
Reading https://pypi.org/simple/parso/
Downloading https://files.pythonhosted.org/packages/a7/bd/e2f4753c5fa93932899243b4299011a757ac212e9bc8ddf062f38df4e78b/parso-0.4.0-py2.py3-none-any.whl#sha256=17cc2d7a945eb42c3569d4564cdf49bde221bc2b552af3eca9c1aad517dcdd33
Best match: parso 0.4.0
Processing parso-0.4.0-py2.py3-none-any.whl
Installing parso-0.4.0-py2.py3-none-any.whl to /root/.emacs.d/anaconda-mode/0.1.13
writing requirements to /root/.emacs.d/anaconda-mode/0.1.13/parso-0.4.0-py3.7.egg/EGG-INFO/requires.txt
Adding parso 0.4.0 to easy-install.pth file

Installed /root/.emacs.d/anaconda-mode/0.1.13/parso-0.4.0-py3.7.egg
Processing dependencies for parso>=0.3.0
Finished processing dependencies for parso>=0.3.0
Finished processing dependencies for jedi>=0.13.0
Searching for service_factory>=0.1.5
Reading https://pypi.org/simple/service_factory/
Downloading https://files.pythonhosted.org/packages/51/ad/7e07f1f11919033a883acc18eb60e0f45e221d98edc42657060f36ff451e/service_factory-0.1.5-py3-none-any.whl#sha256=d466a7b1e1f0e196abdc27a69aef6afdaff3b1814146068573e9c46ae8be2658
Best match: service-factory 0.1.5
Processing service_factory-0.1.5-py3-none-any.whl
Installing service_factory-0.1.5-py3-none-any.whl to /root/.emacs.d/anaconda-mode/0.1.13
Adding service-factory 0.1.5 to easy-install.pth file

Installed /root/.emacs.d/anaconda-mode/0.1.13/service_factory-0.1.5-py3.7.egg
Processing dependencies for service_factory>=0.1.5
Finished processing dependencies for service_factory>=0.1.5
anaconda_mode port 43737
# status: (:error (error connection-failed deleted
 :host localhost :service 43737) :error (error connection-failed failed with code 61
 :host localhost :service 43737))
# point: 1
2019/05/01 13:49:38 socat[91070] E connect(5, LEN=16 AF=2 172.17.0.2:43737, 16): Operation timed out

Process anaconda-socat exited abnormally with code 1

Thanks in advance for any help!

proofit404 commented 5 years ago

Hi, thanks for the report!

We use socat to open in public anaconda-mode port with a dynamic number.

For that, we analyze the output of the docker inspect <name of your container> command.

Can you submit it output here?

Thanks!

cjauvin commented 5 years ago

Thanks for the answer! Here is the output you requested:

[
    {
        "Id": "89f337788eaa75b7af319f43541cbabe49f70a6f66cc33418a103e6876e1e9eb",
        "Created": "2019-05-09T02:12:35.7735767Z",
        "Path": "bash",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 2461,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2019-05-09T02:12:36.5407959Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:954987809e630a0a19304761ff2b8d79e0c3eeab8c0a5b7605baaee6c903f00e",
        "ResolvConfPath": "/var/lib/docker/containers/89f337788eaa75b7af319f43541cbabe49f70a6f66cc33418a103e6876e1e9eb/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/89f337788eaa75b7af319f43541cbabe49f70a6f66cc33418a103e6876e1e9eb/hostname",
        "HostsPath": "/var/lib/docker/containers/89f337788eaa75b7af319f43541cbabe49f70a6f66cc33418a103e6876e1e9eb/hosts",
        "LogPath": "/var/lib/docker/containers/89f337788eaa75b7af319f43541cbabe49f70a6f66cc33418a103e6876e1e9eb/89f337788eaa75b7af319f43541cbabe49f70a6f66cc33418a103e6876e1e9eb-json.log",
        "Name": "/toto",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": [
            "6b15feb95726202b4b41c152b7584b7317035200696e9dc0cf7b9866f20bf667",
            "dfb905fa135dad0643107cf92f503fdbfdd2fc0849088bb1dae1180cb53af6c7",
            "4a8f778f47fe31ce2efa1edf6562aeee029573ba0173a43338a1516b556bea54"
        ],
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": true,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "shareable",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/f8b6e0c04b3adb6b3db6bb68c7bb3fd72607d7de85af00bb1780aa12870bf694-init/diff:/var/lib/docker/overlay2/69ef7f46b97b167d94c6e9dd3bc45028d5755018c9bad6d71a0a88c378c61a06/diff:/var/lib/docker/overlay2/d5f9f7cc7cf7ce031c8f4d7c60c3b341d5e912727ed440b1600ca34c07f1c83e/diff:/var/lib/docker/overlay2/414066b9f7a0dde6bb6ed2e9fdf99c6b30154f90a27021b6353935de3d4b5151/diff:/var/lib/docker/overlay2/82e732276387464c1d8362208d03d5771ca1d9753de83a2df1d8c576f46ddb5f/diff:/var/lib/docker/overlay2/1fd60075d7d5785279d31a24e3723dac3f3d426abdc62520a616ae991faa5092/diff:/var/lib/docker/overlay2/890dc5745824b5a027562bb9ec15f17f0d7f6bbdae60e1c4ea057a22a013af91/diff:/var/lib/docker/overlay2/7aab194d579ebe0ee7b27e36ca8ccceaf37a8dc835e3930ce5fa134531b5cb1d/diff:/var/lib/docker/overlay2/4992195a5863c537796453add97779eace34dfc25262ee39f8e77063b98f0d43/diff:/var/lib/docker/overlay2/ee73315a2f012b0397393f31846b7883b0fb8b33765694b9ffb8420187b446ef/diff",
                "MergedDir": "/var/lib/docker/overlay2/f8b6e0c04b3adb6b3db6bb68c7bb3fd72607d7de85af00bb1780aa12870bf694/merged",
                "UpperDir": "/var/lib/docker/overlay2/f8b6e0c04b3adb6b3db6bb68c7bb3fd72607d7de85af00bb1780aa12870bf694/diff",
                "WorkDir": "/var/lib/docker/overlay2/f8b6e0c04b3adb6b3db6bb68c7bb3fd72607d7de85af00bb1780aa12870bf694/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "89f337788eaa",
            "Domainname": "",
            "User": "",
            "AttachStdin": true,
            "AttachStdout": true,
            "AttachStderr": true,
            "Tty": true,
            "OpenStdin": true,
            "StdinOnce": true,
            "Env": [
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D",
                "PYTHON_VERSION=3.7.3",
                "PYTHON_PIP_VERSION=19.1"
            ],
            "Cmd": [
                "bash"
            ],
            "Image": "python",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "51ec9686979951b0bc36d73fad00c65f377b843be69e2a6f6f30468debdb1bcc",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/51ec96869799",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "0aa0f6852e9b6c84bfa574aa4aa1446cf9a4ef47f1e44d524928559b3f46cde5",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "835b043c96763e1aaea2f95b2c6b356b56242805ce993b921f14fc6d52306178",
                    "EndpointID": "0aa0f6852e9b6c84bfa574aa4aa1446cf9a4ef47f1e44d524928559b3f46cde5",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]
cjauvin commented 5 years ago

I don't want to put any pressure on this issue, but is there anything else I could do to help troubleshooting it?