Skip to content
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

module 'pymaid' has no attribute 'CatmaidInstance' #206

Open
pgibb96 opened this issue Dec 21, 2020 · 31 comments
Open

module 'pymaid' has no attribute 'CatmaidInstance' #206

pgibb96 opened this issue Dec 21, 2020 · 31 comments

Comments

@pgibb96
Copy link

pgibb96 commented Dec 21, 2020

Hi, I recently got an error when attempting to import a neuron from the google auto-seg Catmaid instance to V14. I have been doing this same process for the past year or so without any issues.

I am running on macOS Big Sur. I currently use pyenv to manage my environment, which is running python 3.8.3. I use ipython to run the fafbseg/pymaid commands. When I first tried to use import fafbseg and import pymaid within ipython, I received an error saying that it didn't recognize those modules (I don't remember it verbatim). I uninstalled pymaid and reinstalled it using pip, which got rid of that original error. Now, I am able to import fafbseg and pymaid without errors. However, now when I try to set the catmaid instance using pymaid.CatmaidInstance, I get the error AttributeError: module 'pymaid' has no attribute 'CatmaidInstance'. I'm not sure if it's an issue with my python version, my virtual environment, or maybe my updated macOS. I have been using the same virtual environment for the past year. Any advice?

@jasper-tms
Copy link
Contributor

Your initial errors when trying to import pymaid might have been a result of Philip recently releasing pymaid2.0, which has a different set of dependencies than pymaid1.0 did. If you had installed pymaid as an editable module (via something like pip install -e .), it's possible you git pulled the pymaid2.0 code without installing the new dependencies, in which case import pymaid would indeed complain about missing modules. This happened to me. If that's what happened, the way to fix this would have been to go into your local pymaid repo, make sure you had git pulled the most recent code, then run pip install -r requirements.txt to install the new requirements.

But now that you uninstalled and reinstalled, it seems you're now facing a different problem. What pip command did you use to install pymaid? My guess is perhaps you did pip install pymaid, which actually gets you a different, unrelated package. Just recently with the release of pymaid2.0 Philipp made it available via pip install python-catmaid (see here). So perhaps try pip uninstall pymaid and then pip install python-catmaid and that might fix your issue. Let us know if that does the trick.

@schlegelp
Copy link
Collaborator

Jasper is likely correct: this looks like a confusion with the packages to me. To confirm, could you send us the output of this:

import fafbseg
import pymaid

print(fafbseg.__version__)
print(pymaid.__version__)
print(dir(pymaid))

@pgibb96
Copy link
Author

pgibb96 commented Dec 22, 2020

When I reinstalled pymaid, I believe I did use pip3 install python-catmaid after double checking the github repo for setup instructions. I have not specifically installed the requirements using pip install -r requirements.txt since I just assumed that was run during the general install.

Also, @schlegelp here is the results of those commands.

print(fafbseg.version)

0.2.10

print(pymaid.version)

0.3.8.post4

print(dir(pymaid))

['all', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'version', 'channel', 'conf', 'connection', 'error', 'pb', 'pool', 'serve_forever', 'utils', 'websocket']

@schlegelp
Copy link
Collaborator

OK, that looks like you accidentally installed the other pymaid. Try this:

pip3 uninstall pymaid
pip3 install python-catmaid -U

@pgibb96
Copy link
Author

pgibb96 commented Dec 22, 2020

Okay, I think this worked. Were some of the methods tweaked in pymaid 1.1.0? I received this error when I set the catmaid instance...

WARNING : The provided API token looks suspiciously short: 'fly'
Please note that the name and order of arguments in CatmaidInstance's signature has changed in version 1.1.0 and is now CatmaidInstance(server, api_token, http_user=None, http_password=None, ...) (pymaid)

That was easy enough to fix, but then when I ran resp = fafbseg.merge_neuron(x, target_instance=manual, tag="wilson_lab", min_node_overlap=4, min_overlap_ ...: size=1, merge_limit=.75, min_upload_size=3, min_upload_nodes=1), I received the error AttributeError: module 'pymaid' has no attribute 'get_treenode_table'

Full traceback was

AttributeError Traceback (most recent call last)
in
----> 1 resp = fafbseg.merge_neuron(x, target_instance=manual, tag="wilson_lab", min_node_overlap=4, min_overlap_size=1, merge_limit=.75, min_upload_size=3, min_upload_nodes=1)

~/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/utils.py in wrapper(*args, **kwargs)
34 try:
35 # Execute function
---> 36 res = function(*args, **kwargs)
37 except BaseException:
38 raise

~/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/merge.py in merge_neuron(x, target_instance, tag, min_node_overlap, min_overlap_size, merge_limit, min_upload_size, min_upload_nodes, update_radii, import_tags, label_joins, sid_from_nodes)
337 for n in tqdm(x, desc='Pre-processing neuron(s)',
338 leave=False, disable=not use_pbars):
--> 339 ol = find_fragments(n,
340 min_node_overlap=min_node_overlap,
341 min_nodes=min_overlap_size,

~/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/search.py in find_fragments(x, remote_instance, min_node_overlap, min_nodes)
428
429 # Get nodes for these candidates
--> 430 tn_table = pymaid.get_treenode_table(skids,
431 include_details=False,
432 convert_ts=False,

@schlegelp
Copy link
Collaborator

Ah right: you will also need to update fafbseg. The bottom line is this: pymaid is as of version 1.0.0 fully dependent on navis. pymaid retains all CATMAID-specific functions like fetching and pushing data to the servers but most stuff that applies to neurons in general (e.g. plotting or morphological manipulation like pruning) have been moved to navis. In the process some things still in pymaid have also changed - for example treenode is now just called node.

As a consequence fafbseg had to be updated too. Conveniently, it's now also on PyPI, so you can update like this:

pip3 install fafbseg

Even independent of pymaid, fafbseg in particular has had substantial change: for example, it now does not require you to set a source for the segmentation anymore. I very much recommend you quickly have a look at the docs and examples relevant to your work as they should have all been updated to reflect the changes: https://fafbseg-py.readthedocs.io/en/latest/examples/index.html

@pgibb96
Copy link
Author

pgibb96 commented Dec 22, 2020

Thank you! This is very helpful. Just one last thing. I have been using brainmaps to fetch the data, however it says that module 'fafbseg' has no attribute 'use_brainmaps' when I try to run fafbseg.use_brainmaps('772153499790:fafb_v14:fafb-ffn1-20190805'), which is in the general setup of the docs. My fafbseg is version 1.0.3, pymaid is 2.0.1, brainmappy is 0.2.6. My client json is still in the same place.

@schlegelp
Copy link
Collaborator

for example, it now does not require you to set a source for the segmentation anymore.

That's what I meant here: you don't need to set a segmentation source anymore. Your link to "general setup" is outdated and doesn't exist anymore in the most recent docs. I'm surprised it's still accessible - have you had it bookmarked? Possibly you need to deep reload (alt + refresh) the page. In any event: just check out this tutorial

@pgibb96
Copy link
Author

pgibb96 commented Dec 22, 2020

Ah, I missed that part.

Okay, that actually leads me to another issue. The link you sent was the original tutorial I used after installing the new version of fafbseg. I was able to fetch the correct neuron using pymaid.get_neuron, but when I ran resp = fafbseg.move.merge_into_catmaid(x, target_instance=manual, tag='wilson_lab'), I received the error TypeError: loop of ufunc does not support argument 0 of type float which has no callable rint method.

I tried it both with least number of parameters required (just neuron, target instance, tag) and my normal list of parameters (neuron, instance, tag, min node overlap, min overlap size, merge limit, min upload size, min upload node). I thought maybe it was due to not setting the segmentation source. The traceback is quite a big longer than last time. I can post it if it would help.

As for how I accessed that doc. From that page you linked, I can access it by clicking "Examples" in the top right in-between API and Github. Then, I can click on "General Setup" towards the bottom of the page. I tried a deep reload and it was still there.

@schlegelp
Copy link
Collaborator

schlegelp commented Dec 22, 2020

That's very strange. I suspect you are looking at some cached version. This is what the examples page should look like:
Screenshot 2020-12-22 at 22 23 05

Can you send more example code so I can try reproducing that error please? And yes, the full traceback would be helpful.

@pgibb96
Copy link
Author

pgibb96 commented Dec 23, 2020

Oh interesting, yeah mine has this general setup link under table of contents that brings me to the outdated doc.

Screen Shot 2020-12-23 at 9 22 51 AM

And here is the full list of steps within ipython.

Screen Shot 2020-12-23 at 9 29 34 AM
Screen Shot 2020-12-23 at 9 32 32 AM
Screen Shot 2020-12-23 at 9 33 09 AM

@schlegelp
Copy link
Collaborator

OK that looks like a bug - I will check that. Re the docs: try deep reload to clear your cache.

@schlegelp
Copy link
Collaborator

Turns out this was an error on my part in pymaid.get_node_table which messed up the data types. Surprised this didn't come up earlier...

I have pushed a new version 2.0.2 with a hot fix. Please update:

pip3 install python-catmaid -U

Let me know if that fixes things.

@pgibb96
Copy link
Author

pgibb96 commented Dec 23, 2020

That fixed that issue! Although, I got this error towards the end of the pre-processing stage.

Screen Shot 2020-12-23 at 10 56 40 AM

@schlegelp
Copy link
Collaborator

Darn it! Ok, another hot fix - this time in navis. Please update:

pip3 install navis -U

And try again. On my machine I reach the final step of import now.

@pgibb96
Copy link
Author

pgibb96 commented Dec 23, 2020

Okay, I was able to get to the stage where I can view overlapping neurons, but then I got an error related to Vispy and OpenGL (since I got the warning when importing fafbseg that I was not able to load OpenGL library). The first error was WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>. There were multiple occurrences of errors like these below...

<< caught exception here: >>
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 442, in glEnable
nativefunc = glEnable._native
AttributeError: 'function' object has no attribute '_native'

File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/gl2.py", line 69, in _get_gl_func
raise RuntimeError('Could not load OpenGL library, gl cannot be used')
RuntimeError: Could not load OpenGL library, gl cannot be used
ERROR: Invoking <bound method SceneCanvas.on_draw of <SceneCanvas (PyQt5) at 0x1477673d0>> for DrawEvent

The full traceback is significantly longer and doesn't have the nice color coding.

WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Traceback (most recent call last):
File "/Users/petergibb/.pyenv/versions/fafbseg/bin/ipython", line 8, in
sys.exit(start_ipython())
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/init.py", line 126, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 356, in start
self.shell.mainloop()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 558, in mainloop
self.interact()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 549, in interact
self.run_cell(code, store_history=True)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2857, in run_cell
result = self._run_cell(
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2886, in _run_cell
return runner(coro)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/async_helpers.py", line 68, in pseudo_sync_runner
coro.send(None)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3062, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3254, in run_ast_nodes
if (await self.run_code(code, result, async
=asy)):
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 16, in
resp = fafbseg.move.merge_into_catmaid(x, target_instance=manual, tag="wilson_lab", min_node_overlap=4, min_overlap_size=1, merge_limit=.75, min_upload_size=3, min_upload_nodes=1)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/utils.py", line 85, in wrapper
res = function(*args, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/merge.py", line 224, in merge_into_catmaid
ol, bn = confirm_overlap(n, ol, viewer=viewer)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/interfaces.py", line 70, in confirm_overlap
_ = input(msg)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 508, in event
out = super(QtBaseCanvasBackend, self).event(ev)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 825, in paintGL
self._vispy_canvas.events.draw(region=None)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 455, in call
self._invoke_callback(cb, event)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 473, in _invoke_callback
_handle_exception(self.ignore_callback_errors,
<< caught exception here: >>
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 442, in glEnable
nativefunc = glEnable._native
AttributeError: 'function' object has no attribute '_native'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 471, in _invoke_callback
cb(event)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 217, in on_draw
self._draw_scene()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 266, in _draw_scene
self.draw_visual(self.scene)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 304, in draw_visual
node.draw()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/visuals.py", line 99, in draw
self._visual_superclass.draw(self)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/visual.py", line 595, in draw
v.draw()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/visual.py", line 442, in draw
self._program.draw(self._vshare.draw_mode,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/shaders/program.py", line 101, in draw
Program.draw(self, *args, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/program.py", line 533, in draw
canvas.context.flush_commands()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/context.py", line 175, in flush_commands
self.shared.parser.parse([('CURRENT', 0, fbo)])
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 819, in parse
self._parse(command)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 743, in _parse
self._gl_initialize()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 836, in _gl_initialize
gl.glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 444, in glEnable
nativefunc = glEnable._native = _get_gl_func("glEnable", None, (ctypes.c_uint,))
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/gl2.py", line 69, in _get_gl_func
raise RuntimeError('Could not load OpenGL library, gl cannot be used')
RuntimeError: Could not load OpenGL library, gl cannot be used
ERROR: Invoking <bound method SceneCanvas.on_draw of <SceneCanvas (PyQt5) at 0x1477673d0>> for DrawEvent
WARNING: Traceback (most recent call last):
File "/Users/petergibb/.pyenv/versions/fafbseg/bin/ipython", line 8, in
sys.exit(start_ipython())
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/init.py", line 126, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 356, in start
self.shell.mainloop()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 558, in mainloop
self.interact()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 549, in interact
self.run_cell(code, store_history=True)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2857, in run_cell
result = self._run_cell(
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2886, in _run_cell
return runner(coro)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/async_helpers.py", line 68, in pseudo_sync_runner
coro.send(None)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3062, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3254, in run_ast_nodes
if (await self.run_code(code, result, async
=asy)):
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 16, in
resp = fafbseg.move.merge_into_catmaid(x, target_instance=manual, tag="wilson_lab", min_node_overlap=4, min_overlap_size=1, merge_limit=.75, min_upload_size=3, min_upload_nodes=1)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/utils.py", line 85, in wrapper
res = function(*args, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/merge.py", line 224, in merge_into_catmaid
ol, bn = confirm_overlap(n, ol, viewer=viewer)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/interfaces.py", line 70, in confirm_overlap
_ = input(msg)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 508, in event
out = super(QtBaseCanvasBackend, self).event(ev)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 825, in paintGL
self._vispy_canvas.events.draw(region=None)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 455, in call
self._invoke_callback(cb, event)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 473, in _invoke_callback
_handle_exception(self.ignore_callback_errors,
<< caught exception here: >>
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 1361, in glViewport
nativefunc = glViewport._native
AttributeError: 'function' object has no attribute '_native'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 471, in _invoke_callback
cb(event)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/context.py", line 176, in flush_commands
self.glir.flush(self.shared.parser)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 572, in flush
self._shared.flush(parser)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 494, in flush
parser.parse(self._filter(self.clear(), parser))
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 819, in parse
self._parse(command)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 750, in parse
getattr(gl, id
)(*args)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 1363, in glViewport
nativefunc = glViewport._native = _get_gl_func("glViewport", None, (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int,))
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/gl2.py", line 69, in _get_gl_func
raise RuntimeError('Could not load OpenGL library, gl cannot be used')
RuntimeError: Could not load OpenGL library, gl cannot be used
ERROR: Invoking <bound method GLContext.flush_commands of <GLContext at 0x111b734c0>> for DrawEvent
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Traceback (most recent call last):
File "/Users/petergibb/.pyenv/versions/fafbseg/bin/ipython", line 8, in
sys.exit(start_ipython())
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/init.py", line 126, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 356, in start
self.shell.mainloop()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 558, in mainloop
self.interact()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 549, in interact
self.run_cell(code, store_history=True)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2857, in run_cell
result = self._run_cell(
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2886, in _run_cell
return runner(coro)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/async_helpers.py", line 68, in pseudo_sync_runner
coro.send(None)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3062, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3254, in run_ast_nodes
if (await self.run_code(code, result, async
=asy)):
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 16, in
resp = fafbseg.move.merge_into_catmaid(x, target_instance=manual, tag="wilson_lab", min_node_overlap=4, min_overlap_size=1, merge_limit=.75, min_upload_size=3, min_upload_nodes=1)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/utils.py", line 85, in wrapper
res = function(*args, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/merge.py", line 224, in merge_into_catmaid
ol, bn = confirm_overlap(n, ol, viewer=viewer)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/interfaces.py", line 70, in confirm_overlap
_ = input(msg)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 508, in event
out = super(QtBaseCanvasBackend, self).event(ev)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 443, in mousePressEvent
self._vispy_mouse_press(
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/base.py", line 181, in _vispy_mouse_press
ev = self._vispy_canvas.events.mouse_press(**kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 455, in call
self._invoke_callback(cb, event)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 473, in _invoke_callback
_handle_exception(self.ignore_callback_errors,
<< caught exception here: >>
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 442, in glEnable
nativefunc = glEnable._native
AttributeError: 'function' object has no attribute '_native'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 471, in _invoke_callback
cb(event)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/navis/plotting/vispy/viewer.py", line 1118, in on_mouse_press
vis_at = viewer.visuals_at([event.pos[0] + 15,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/navis/plotting/vispy/viewer.py", line 1064, in visuals_at
p = self._render_fb(crop=(pos[0] - self._picking_radius / 2,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/navis/plotting/vispy/viewer.py", line 353, in _render_fb
p = self.canvas._render_picking(crop=crop)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 483, in _render_picking
img = self.render(bgcolor=(0, 0, 0, 0), crop=crop)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 257, in render
self._draw_scene(bgcolor=bgcolor)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 266, in _draw_scene
self.draw_visual(self.scene)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 304, in draw_visual
node.draw()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/visuals.py", line 99, in draw
self._visual_superclass.draw(self)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/visual.py", line 595, in draw
v.draw()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/visual.py", line 442, in draw
self._program.draw(self._vshare.draw_mode,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/shaders/program.py", line 101, in draw
Program.draw(self, *args, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/program.py", line 533, in draw
canvas.context.flush_commands()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/context.py", line 175, in flush_commands
self.shared.parser.parse([('CURRENT', 0, fbo)])
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 819, in parse
self._parse(command)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 743, in _parse
self._gl_initialize()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 836, in _gl_initialize
gl.glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 444, in glEnable
nativefunc = glEnable._native = _get_gl_func("glEnable", None, (ctypes.c_uint,))
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/gl2.py", line 69, in _get_gl_func
raise RuntimeError('Could not load OpenGL library, gl cannot be used')
RuntimeError: Could not load OpenGL library, gl cannot be used
ERROR: Invoking <function on_mouse_press at 0x1355d3940> for MouseEvent
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
ERROR: Invoking <bound method SceneCanvas.on_draw of <SceneCanvas (PyQt5) at 0x1477673d0>> repeat 2
ERROR: Invoking <bound method GLContext.flush_commands of <GLContext at 0x111b734c0>> repeat 2
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
ERROR: Invoking <bound method SceneCanvas.on_draw of <SceneCanvas (PyQt5) at 0x1477673d0>> repeat 4
ERROR: Invoking <bound method GLContext.flush_commands of <GLContext at 0x111b734c0>> repeat 4
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Traceback (most recent call last):
File "/Users/petergibb/.pyenv/versions/fafbseg/bin/ipython", line 8, in
sys.exit(start_ipython())
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/init.py", line 126, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 356, in start
self.shell.mainloop()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 558, in mainloop
self.interact()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 549, in interact
self.run_cell(code, store_history=True)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2857, in run_cell
result = self._run_cell(
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2886, in _run_cell
return runner(coro)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/async_helpers.py", line 68, in pseudo_sync_runner
coro.send(None)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3062, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3254, in run_ast_nodes
if (await self.run_code(code, result, async
=asy)):
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 16, in
resp = fafbseg.move.merge_into_catmaid(x, target_instance=manual, tag="wilson_lab", min_node_overlap=4, min_overlap_size=1, merge_limit=.75, min_upload_size=3, min_upload_nodes=1)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/utils.py", line 85, in wrapper
res = function(*args, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/merge.py", line 224, in merge_into_catmaid
ol, bn = confirm_overlap(n, ol, viewer=viewer)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/interfaces.py", line 70, in confirm_overlap
_ = input(msg)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 508, in event
out = super(QtBaseCanvasBackend, self).event(ev)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/backends/_qt.py", line 443, in mousePressEvent
self._vispy_mouse_press(
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/app/base.py", line 181, in _vispy_mouse_press
ev = self._vispy_canvas.events.mouse_press(**kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 455, in call
self._invoke_callback(cb, event)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 473, in _invoke_callback
_handle_exception(self.ignore_callback_errors,
<< caught exception here: >>
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 442, in glEnable
nativefunc = glEnable._native
AttributeError: 'function' object has no attribute '_native'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/util/event.py", line 471, in _invoke_callback
cb(event)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/navis/plotting/vispy/viewer.py", line 1118, in on_mouse_press
vis_at = viewer.visuals_at([event.pos[0] + 15,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/navis/plotting/vispy/viewer.py", line 1064, in visuals_at
p = self._render_fb(crop=(pos[0] - self._picking_radius / 2,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/navis/plotting/vispy/viewer.py", line 353, in _render_fb
p = self.canvas._render_picking(crop=crop)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 483, in _render_picking
img = self.render(bgcolor=(0, 0, 0, 0), crop=crop)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 257, in render
self._draw_scene(bgcolor=bgcolor)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 266, in _draw_scene
self.draw_visual(self.scene)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/canvas.py", line 304, in draw_visual
node.draw()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/scene/visuals.py", line 99, in draw
self._visual_superclass.draw(self)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/visual.py", line 595, in draw
v.draw()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/visual.py", line 442, in draw
self._program.draw(self._vshare.draw_mode,
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/visuals/shaders/program.py", line 101, in draw
Program.draw(self, *args, **kwargs)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/program.py", line 533, in draw
canvas.context.flush_commands()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/context.py", line 175, in flush_commands
self.shared.parser.parse([('CURRENT', 0, fbo)])
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 819, in parse
self._parse(command)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 743, in _parse
self._gl_initialize()
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/glir.py", line 836, in _gl_initialize
gl.glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/_gl2.py", line 444, in glEnable
nativefunc = glEnable._native = _get_gl_func("glEnable", None, (ctypes.c_uint,))
File "/Users/petergibb/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/vispy/gloo/gl/gl2.py", line 69, in _get_gl_func
raise RuntimeError('Could not load OpenGL library, gl cannot be used')
RuntimeError: Could not load OpenGL library, gl cannot be used
ERROR: Invoking <function on_mouse_press at 0x1355d3940> for MouseEvent
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
WARNING: Error drawing visual <vispy.visuals.line.line._GLLineVisual object at 0x141f6a100>
ERROR: Invoking <bound method SceneCanvas.on_draw of <SceneCanvas (PyQt5) at 0x1477673d0>> repeat 8
ERROR: Invoking <bound method GLContext.flush_commands of <GLContext at 0x111b734c0>> repeat 8

@schlegelp
Copy link
Collaborator

schlegelp commented Dec 25, 2020

That looks like an issue with vispy or PyQt5. Am I correct in that it used to work on your machine and other than updating fafbseg/navis/pymaid you have not changed anything else (like drivers)? If so, could you run this:

pip3 list

and send me the version of anything that has PyQt in its name?

@pgibb96
Copy link
Author

pgibb96 commented Dec 25, 2020

Yes, I've been using this machine to work from home since march and I've been using fafbseg to import my google autoseg neurons. I haven't changed any drivers to my knowledge (not sure how updating my macOS to the newest version would affect drivers). Interestingly, I just tried to run the whole process again and after getting that same error, I tried quitting out with quit() and enter and it brought me to the next stage (selecting which neurons to merge). I think you're right that it's just an issue with the visualization. When I ran pip3 list, I found

PyQt5 5.15.2
PyQt5-sip 12.8.1

@schlegelp
Copy link
Collaborator

Could you try with an earlier version of PyQt5?

pip3 install PyQt5==5.14.2

Make sure to restart your Python session after the install and before trying it again.

@pgibb96
Copy link
Author

pgibb96 commented Jan 4, 2021

Hi Philipp, sorry I thought I hit comment. I still have the openGL issue, but I was able to successfully* import the neuron. For some reason, after I chose which neuron to merge mine into and started the import process, there was some delay and I eventually got this error...

Processing neuron "Google: 2266429077" (197004135) [0/1]
Done.                                                                                                                                     
Extracting new nodes to upload... Done.
---------------------------------------------------------------------------                                                               
HTTPError                                 Traceback (most recent call last)                                                               
<ipython-input-3-6e42ff7ea7fb> in <module>
     14 x = pymaid.get_neuron(197004135, remote_instance=auto)
     15 
---> 16 resp = fafbseg.move.merge_into_catmaid(x, target_instance=manual, tag="wilson_lab", min_node_overlap=4, min_overlap_size=1, merge_limit=.75, min_upload_size=3, min_upload_nodes=1)
 
~/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/utils.py in wrapper(*args, **kwargs)
     83         try:
     84             # Execute function
---> 85             res = function(*args, **kwargs)
     86         except BaseException:
     87             raise
 
~/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/fafbseg/move/merge.py in merge_into_catmaid(x, target_instance, tag, min_node_overlap, min_overlap_size, merge_limit, min_upload_size, min_upload_nodes, update_radii, import_tags, label_joins, sid_from_nodes, mesh)
    378                 source_info = {}
     379 
--> 380             resp = pymaid.upload_neuron(f,
    381                                         import_tags=import_tags,
    382                                         import_annotations=False,
 
~/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/pymaid/cache.py in wrapper(*args, **kwargs)
    175         rm.caching = False
    176         # Execute function
--> 177         res = function(*args, **kwargs)
    178         # Set caching to old value
    179         rm.caching = old_value
 
~/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/pymaid/upload.py in upload_neuron(x, import_tags, import_annotations, import_connectors, reuse_existing_connectors, skeleton_id, neuron_id, force_id, source_id, source_project_id, source_url, source_type, remote_instance)
    512             # to have a log of it without interrupting potential subsequent uploads.
    513             try:
--> 514                 resp = remote_instance.fetch(import_url,
    515                                              post=import_post,
    516                                              files={'file': file})
 
 ~/.pyenv/versions/3.8.2/envs/fafbseg/lib/python3.8/site-packages/pymaid/client.py in fetch(self, url, post, files, on_error, desc, disable_pbar, leave_pbar, return_type)
     471         if errors:
     472             if on_error == 'raise':
 --> 473                 raise HTTPError('{} errors encountered: {}'.format(len(errors),
     474                                                                    '\n'.join(errors)))
     475             else:
 
HTTPError: 1 errors encountered: 500 Server Error: duplicate key value violates unique constraint "skeleton_origin_pkey1"
DETAIL:  Key (id)=(19996) already exists.
for url: https://neuropil.janelia.org/tracing/fafb/v14/1/skeletons/import

When I checked v14 my cell is there, but I just don't know if this will end up causing any issues down the line.

@schlegelp
Copy link
Collaborator

Does this happen every single time?

This could be a one time glitch due to how the CATMAID server backend imports the new data. If that's the case, the upload will have stopped at some point - since the larger new branches are uploaded first, it may look like your neuron is complete but in fact some branches will still be missing. If it really is this one time glitch, you can just restart the merge process.

By-the-by: I edited your above post to format the error message as code (using ``` at the beginning and the end) - much easier to read.

@pgibb96
Copy link
Author

pgibb96 commented Jan 4, 2021

The openGL issue happens every time. The new one with the duplicate key pair has just happened once. I believe you are right. The neuron in autoseg is about 100 nodes longer than the neuron in v14. I'll merge again. And thanks for the edit! I didn't know github was able to format the traceback so nicely. When I tried using the code option for the openGL long error message a few comments ago, it didn't make a big difference. Good to know for the future!

@schlegelp
Copy link
Collaborator

Did you try downgrading PyQt5 as I suggested?

Could you try with an earlier version of PyQt5?

pip3 install PyQt5==5.14.2

Make sure to restart your Python session after the install and before trying it again.

@pgibb96
Copy link
Author

pgibb96 commented Jan 4, 2021

Yeah, I tried that last week. That hasn't fixed it. Pip list shows it as 5.14.2 and just to double check, when I load up iPython to check the version I get this.

In [19]: import pkg_resources                                                                                                                             
In [20]: pkg_resources.get_distribution("PyQt5").version                                                                                                  
Out[20]: '5.14.2'

@schlegelp
Copy link
Collaborator

Hmm. This looks like an issue with library used to build the 3D viewer, vispy. It's probably best to test one of the basic vispy examples and check if that already bugs out. Could you download this example (right-click on "Raw" and then "Download linked file" to download 'mesh.py') and try to run it from terminal like so:

$ cd ~/Downloads
$ python3 mesh.py

@pgibb96
Copy link
Author

pgibb96 commented Jan 4, 2021

So I got this error which seems to relate to this issue on their github vispy/vispy#1885

Traceback (most recent call last):
  File "mesh.py", line 10, in <module>
    from vispy import app, gloo, visuals
  File "/Users/petergibb/.pyenv/versions/fafbseg/lib/python3.8/site-packages/vispy/__init__.py", line 30, in <module>
    from .util import config, set_log_level, keys, sys_info  # noqa
  File "/Users/petergibb/.pyenv/versions/fafbseg/lib/python3.8/site-packages/vispy/util/__init__.py", line 14, in <module>
    from . import fonts       # noqa
  File "/Users/petergibb/.pyenv/versions/fafbseg/lib/python3.8/site-packages/vispy/util/fonts/__init__.py", line 13, in <module>
    from ._triage import _load_glyph, list_fonts  # noqa, analysis:ignore
  File "/Users/petergibb/.pyenv/versions/fafbseg/lib/python3.8/site-packages/vispy/util/fonts/_triage.py", line 14, in <module>
    from ._quartz import _load_glyph, _list_fonts
  File "/Users/petergibb/.pyenv/versions/fafbseg/lib/python3.8/site-packages/vispy/util/fonts/_quartz.py", line 12, in <module>
    from ...ext.cocoapy import cf, ct, quartz, CFRange, CFSTR, CGGlyph, UniChar, \
  File "/Users/petergibb/.pyenv/versions/fafbseg/lib/python3.8/site-packages/vispy/ext/cocoapy.py", line 1126, in <module>
    NSEventTrackingRunLoopMode = c_void_p.in_dll(
ValueError: dlsym(RTLD_DEFAULT, NSEventTrackingRunLoopMode): symbol not found

@schlegelp
Copy link
Collaborator

Different error but at least it's something something tangible. If I read that thread correctly, you could try switching Python versions to 3.7 or 3.9?

@pgibb96
Copy link
Author

pgibb96 commented Jan 6, 2021

Ah yes, I'll try that. I use pyenv for managing my python environments and I was running into errors with trying to install either python 3.7 or 3.9. Something about my computer using macOS Big Sur and my current xcode version. I'm going to try to sort that out this morning.

@schlegelp
Copy link
Collaborator

Just FYI re the duplicate key error. Turns out that's an issue with the CATMAID server and Tom Kazimiers has fixed the data base but is not quite sure where it came from in the first place. So your imports should work now but we need to keep an eye on it and let Tom know if it pops up again.

@pgibb96
Copy link
Author

pgibb96 commented Jan 15, 2021

Thanks for the update!

@schlegelp
Copy link
Collaborator

Re the issue with vispy and BigSur, I posted a work around that will let you import navis and use non-vispy related functions:

navis-org/navis#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants