Closed dadanhan closed 2 years ago
My first hunch is that you are using the wrong URL for your CATMAID server. The error message suggests that the server url is set to 'myserverwebsite'
which can't be right.
connect_catmaid()
, as you invoke it, uses the CATMAID_SERVER
environment variable to initialise a connection. It does not check if the connection is working though. Hence you get your error when you first try to fetch data via pymaid.get_neuron
.
So I've just edited the proper address to 'myserverwebsite'. The thing is I've had another lab member check my exact code with the exact same credentials and they seem to access the data fine. Could it be a Windows issue? The check was done on a non-Windows machine.
I'm a bit confused. Could you share the output of this:
rm = pymaid.connect_catmaid()
rm
INFO : Global CATMAID instance set. Caching is ON. (pymaid) CatmaidInstance at 2063042623952. Server: https://neurophyla.mrc-lmb.cam.ac.uk/catmaid/drosophila/l1/seymour Project: 1 Caching True (size limit 128; time limit None) Cache size: 0.0
Ah, that looks reasonable. Do you get an error if you run for example
ul = pymaid.get_user_list()
yes I get the error:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='neurophyla.mrc-lmb.cam.ac.uk', port=443): Max retries exceeded with url: /catmaid/drosophila/l1/seymour/user-list (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001BC37544C70>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
which is exactly the same as before.
I guess the other thing you might want to check is if you can reach that server from your machine. In a terminal:
ping -c 5 neurophyla.mrc-lmb.cam.ac.uk
You should be seeing something like this:
64 bytes from 131.111.85.110: icmp_seq=2 ttl=50 time=23.726 ms
Also: I could be wrong but depending on whether you are connected via the LMB's wired network you might have use the internal name for this server.
@clbarnes @aschampion any thoughts?
Oh so I try
Test-NetConnection neurophyla.mrc-lmb.cam.ac.uk
because I'm running it on Windows Powershell and I get
ComputerName : myserveraddress
RemoteAddress : 111.111.111.someIP
InterfaceAlias : Wi-Fi 2
SourceAddress : 111.111.111.someIP
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
So it indeed seems like I can't even access it from my machine rather than it being a problem in pymaid.
I said to Dan in a backchannel that I'm happy to blame Windows :laughing: but that's not exactly a solution. For reference I can use his credentials and the exact same code without issue from my computer outside the LMB network. Dan was using the LMB Guest network, which should behave as if it's outside.
Try neurophyla.lmb.internal
just in case. Alternatively, there was a SO post which suggested that servers sometimes refuse to acknowledge requests if they're suspicious about the user-agent header, so we could try to change that and pretend to use a proper operating system.
@schlegelp and @clbarnes Thank you for all the help, it seems that this is an issue with my specific machine and not an issue with pymaid.
Hi, so I've just tried to use pymaid to do a simple check and see if I can extract data out of CATMAID...my code is the following
I've checked that the lines
import pymaid
andrm=pymaid.connect_catmaid()
work. They indeed work. The error is given by the lineneuron_list = pymaid.get_neuron(['1a PN'],remote_instance=rm)
and it gives:Could you please help solving this error? For clarification I'm using Windows and Python 3.8.10.