jianhuupenn / SpaGCN

SpaGCN: Integrating gene expression, spatial location and histology to identify spatial domains and spatially variable genes by graph convolutional network
MIT License
199 stars 60 forks source link

NotADirectoryError #48

Closed xiao-kong-long closed 2 years ago

xiao-kong-long commented 2 years ago

Hello developer! I have tried configure an environment for SpaGCN on ubuntu server, however, three ways to installation in tutorial are not worked. And all of them report same errors, as follows: `1.2.5 Calculateing adj matrix using histology image... Var of c0,c1,c2 = 33.30687202862215 174.55510595352243 46.84205750749746 Var of x,y,z = 5606737.526317932 4468793.817921193 5606737.526317932 Run 1: l [0.01, 1000], p [0.0, 3629.740622904294] Run 2: l [0.01, 500.005], p [0.0, 3605.19131298059] Run 3: l [0.01, 250.0075], p [0.0, 3510.2840084795375] Run 4: l [0.01, 125.00874999999999], p [0.0, 3176.0043843625317] Run 5: l [0.01, 62.509375], p [0.0, 2292.207220295841] Run 6: l [0.01, 31.2596875], p [0.0, 1045.6601323127943] Run 7: l [0.01, 15.63484375], p [0.0, 292.86805881857936] Run 8: l [0.01, 7.822421875], p [0.0, 59.204869260873146] Run 9: l [0.01, 3.9162109375], p [0.0, 9.650458958139229] Run 10: l [0.01, 1.9631054687499998], p [0.0, 1.3308386992026033] Run 11: l [0.9865527343749999, 1.9631054687499998], p [0.1348709909344703, 1.3308386992026033] Run 12: l [0.9865527343749999, 1.4748291015625], p [0.1348709909344703, 0.5474268365922781] Run 13: l [1.23069091796875, 1.4748291015625], p [0.30070770989879625, 0.5474268365922781] Run 14: l [1.352760009765625, 1.4748291015625], p [0.41318173153943594, 0.5474268365922781] Run 15: l [1.4137945556640625, 1.4748291015625], p [0.477488424145156, 0.5474268365922781] Run 16: l [1.4137945556640625, 1.4443118286132812], p [0.477488424145156, 0.511742077238301] recommended l = 1.4290531921386718 Traceback (most recent call last): File "/home/yli/anaconda3/envs/Hu_spagcn_env/lib/python3.8/linecache.py", line 95, in updatecache stat = os.stat(fullname) NotADirectoryError: [Errno 20] Not a directory: '/home/yli/.local/lib/python3.8/site-packages/SpaGCN-1.2.5-py3.8.egg/SpaGCN/util.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/yli/HuQiFeng/SpaGCN-master/tutorial/test_in_DLPFC.py", line 72, in res=spg.search_res(adata, adj, l, n_clusters, start=0.7, step=0.1, tol=5e-3, lr=0.05, max_epochs=20, r_seed=r_seed, t_seed=t_seed, n_seed=n_seed) File "/home/yli/.local/lib/python3.8/site-packages/SpaGCN-1.2.5-py3.8.egg/SpaGCN/util.py", line 343, in search_res File "/home/yli/.local/lib/python3.8/site-packages/torch/random.py", line 40, in manual_seed torch.cuda.manual_seed_all(seed) File "/home/yli/.local/lib/python3.8/site-packages/torch/cuda/random.py", line 113, in manual_seed_all _lazy_call(cb, seed_all=True) File "/home/yli/.local/lib/python3.8/site-packages/torch/cuda/init.py", line 163, in _lazy_call _lazy_seed_tracker.queue_seed_all(callable, traceback.format_stack()) File "/home/yli/anaconda3/envs/Hu_spagcn_env/lib/python3.8/traceback.py", line 197, in format_stack return format_list(extract_stack(f, limit=limit)) File "/home/yli/anaconda3/envs/Hu_spagcn_env/lib/python3.8/traceback.py", line 211, in extract_stack stack = StackSummary.extract(walk_stack(f), limit=limit) File "/home/yli/anaconda3/envs/Hu_spagcn_env/lib/python3.8/traceback.py", line 366, in extract f.line File "/home/yli/anaconda3/envs/Hu_spagcn_env/lib/python3.8/traceback.py", line 288, in line self._line = linecache.getline(self.filename, self.lineno).strip() File "/home/yli/anaconda3/envs/Hu_spagcn_env/lib/python3.8/linecache.py", line 16, in getline lines = getlines(filename, module_globals) File "/home/yli/anaconda3/envs/Hu_spagcn_env/lib/python3.8/linecache.py", line 47, in getlines return updatecache(filename, module_globals) File "/home/yli/anaconda3/envs/Hu_spagcn_env/lib/python3.8/linecache.py", line 103, in updatecache data = cache[filename][0]() File "", line 217, in get_source UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb7 in position 7732: invalid start byte

Process finished with exit code 1`

where 'test_DLPFC.py' is a file that copys the python code from toturial without any changing. Maybe torch's problem? I have tried two ways to install pytorch: pip directly, or conda install as pytorch.org recommends, both of them are in same result. I didn't try the python3 setup.py install --user method, because this ways reported timeout errors.

xiao-kong-long commented 2 years ago

All I have done is : conda create -n Hu_spagcn_env python=3.8.8 conda activate Hu_spagcn_env pip install pip3 install --user SpaGCN -i https://pypi.mirrors.ustc.edu.cn/simple/ pip install opencv-python -i https://pypi.mirrors.ustc.edu.cn/simple/ and run the test_DLPFC.py file.

xiao-kong-long commented 2 years ago

Hello, don't kown the reasons, after a dinner, the problem is disappear.