Damseh / VascularGraph

MIT License
18 stars 3 forks source link

Syntax error in line 1210 of \lib\site-packages\apptools\persistence\state_pickler.py (original title: util_py raises a syntax error in line 780) #4

Closed liorgolgher closed 4 years ago

liorgolgher commented 4 years ago

Hi Rafat,

I hope the lockdown finds you well (:

I've tried to install the updated version of VG on another computer and faced the following error during setup:

File "...\anaconda3\envs\test\lib\site-packages\VascGraph-0.1.0-py3.7.egg\VascGraph\Extra\util_.py", line 780
    except ValueError,e:
                     ^
SyntaxError: invalid syntax

I guess the same error holds for line 788. I've failed to replace them myself with except ValueError as e: Can you please direct me to the file I should modify, or ping me when a modified package is available?

Thanks! Lior

Damseh commented 4 years ago

Hi Lior, I hope you're doing great as well! That's weird, I tried to reinstall and test, and it is working! Can I know how you did install and what is the python version in your installation? Best, Rafat

liorgolgher commented 4 years ago

I'm glad to hear you're well!

I took the following installation steps:

conda create -n vg python=3.7 spyder matplotlib scipy networkx=2.2 mayavi

conda activate vg

git clone https://github.com/Damseh/VascularGraph.git

cd VascularGraph

python setup.py install

The resulting python version is 3.7.6. The only warning I've got during the cloning step does not seem to be related:

warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'build/lib/VascGraph/Extra/Example.py'
  'build/lib/VascGraph/Extra/example.py'
  'VascGraph/Extra/Example.py'
  'VascGraph/Extra/example.py'

Since it works for you, I suspect that it has to do with my system. I therefore erased VascularGraph folder, fully uninstalled my anaconda, installed the latest Miniconda3 (Python 3.7 for Windows 64-bit) and conducted the steps above afresh. Alas I got the very same syntax error in line 780.

If it's any help, I'm using Windows 10 version 1909, build 18363.720 on this machine.

I did not have this issue on Linux or Mac, but that was before the latest VG commit (6f7fb54).

Thanks again, Lior

Damseh commented 4 years ago

Hi Lior, The 'Extra' sub-package contains some functions and routines that are not important for the skeletonization in demo.py module. I used to have them first when I started to develop my algorithm. After cloning, try to remove the 'Extra' folder from VascularGraph/VascGraph and from VascularGraph⁩/⁨build⁩/⁨lib⁩/VascGraph, then install python setup.py install

Damseh commented 4 years ago

So the installation steps will be:

conda create -n vg python=3.7 spyder matplotlib scipy networkx=2.2 mayavi

conda activate vg

git clone https://github.com/Damseh/VascularGraph.git

cd VascularGraph

rm -R VascGraph/Extra/ build/lib/VascGraph/Extra/

python setup.py install

liorgolgher commented 4 years ago

Removing the extra folders has resolved the issue I've reported, but not the real problem that prevented VG from running on my system. The resulting traceback after removing the folders was:

Traceback (most recent call last): File "demo.py", line 18, in import VascGraph as vg File "C:\Users\LENOVO\Downloads\VascularGraph\VascGraph__init.py", line 10, in from VascGraph import GraphLab File "C:\Users\LENOVO\Downloads\VascularGraph\VascGraph\GraphLab\init__.py", line 9, in from VascGraph.GraphLab.GraphPlot import GraphPlot File "C:\Users\LENOVO\Downloads\VascularGraph\VascGraph\GraphLab\GraphPlot.py", line 10, in from mayavi.core.api import Engine, PipelineBase File "C:\Users\LENOVO.conda\envs\vg\lib\site-packages\mayavi\core\api.py", line 5, in from .pipeline_base import PipelineBase File "C:\Users\LENOVO.conda\envs\vg\lib\site-packages\mayavi\core\pipeline_base.py", line 13, in from mayavi.core.base import Base File "C:\Users\LENOVO.conda\envs\vg\lib\site-packages\mayavi\core\base.py", line 19, in from tvtk.pyface.tvtk_scene import TVTKScene File "C:\Users\LENOVO.conda\envs\vg\lib\site-packages\tvtk\pyface\tvtk_scene.py", line 19, in from apptools.persistence import state_pickler File "C:\Users\LENOVO.conda\envs\vg\lib\site-packages\apptools\persistence\state_pickler.py", line 1210

 ^

SyntaxError: invalid syntax

The solution I've been overlooking for the past week can be found here: remove the __pycache__ subfolder of the relevant persistence folder reported in the error log (e.g. 'C:\Users\LENOVO.conda\envs\vg\lib\site-packages\apptools\persistence__pycache__'), then reinstall apptools through pip: pip install -U apptools

I hope this transcript assists other VG users.

VG works now on my laptop! I apologize for wasting your time on the wrong problem. Thanks a lot for your continued help!

Damseh commented 4 years ago

No problem! I am glad that it works now. All the best