kr-colab / diploSHIC

feature-based deep learning for the identification of selective sweeps
MIT License
49 stars 14 forks source link

Python 3.8 not supported #31

Closed oushujun closed 3 years ago

oushujun commented 3 years ago

Hello,

Seems like python 3.8 is not supported:

Traceback (most recent call last): File "/mnt/tiger/osj/git_bin/diploSHIC/makeFeatureVecsForChrArmFromVcfDiploid.py", line 126, in startTime = time.clock() AttributeError: module 'time' has no attribute 'clock'

From the Python 3.8 doc and this post:

The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior. (Contributed by Matthias Bussonnier in bpo-36895.)

There are more than one place in diploSHIC that uses this function:

diploSHIC/diploSHIC.py: start = time.clock() diploSHIC/diploSHIC.py: sys.stderr.write("total time spent fitting and evaluating: %f secs\n" %(time.clock()-start)) diploSHIC/makeFeatureVecsForChrArmFromVcfDiploid.py:startTime = time.clock() diploSHIC/makeFeatureVecsForChrArmFromVcfDiploid.py:sys.stderr.write("completed in %g seconds\n" %(time.clock()-startTime)) diploSHIC/makeFeatureVecsForChrArmFromVcf_ogSHIC.py: startTime = time.clock() diploSHIC/makeFeatureVecsForChrArmFromVcf_ogSHIC.py: sys.stderr.write("took %s seconds\n" %(time.clock()-startTime)) diploSHIC/makeFeatureVecsForChrArmFromVcf_ogSHIC.py:startTime = time.clock() diploSHIC/makeFeatureVecsForChrArmFromVcf_ogSHIC.py:sys.stderr.write("completed in %g seconds\n" %(time.clock()-startTime)) diploSHIC/makeFeatureVecsForSingleMsDiploid.py:start = time.clock() diploSHIC/makeFeatureVecsForSingleMsDiploid.py: sys.stderr.write("finished %d reps after %f seconds\n" %(numInstancesDone, time.clock()-start)) diploSHIC/makeFeatureVecsForSingleMsDiploid.py:sys.stderr.write("total time spent calculating summary statistics and generating feature vectors: %f secs\n" %(time.clock()-start)) diploSHIC/makeFeatureVecsForSingleMs_ogSHIC.py:start = time.clock() diploSHIC/makeFeatureVecsForSingleMs_ogSHIC.py: time.clock()-start))

Specify an older python version during the installation could solve this: conda install python=3.7.0

Best, Shujun

oushujun commented 3 years ago

Sorry, my diploSHIC was downloaded from the fall of 2018, I just saw that this bug has been fixed (https://github.com/kr-colab/diploSHIC/commit/c71074e4811413d0a9f322ec05418c346748ff7c).

oushujun commented 3 years ago

Downloaded the latest version yesterday and installed with Python 3.8.3. Seems like time.clock() still exists:

diploSHIC/makeFeatureVecsForChrArmFromVcfDiploid.py:163: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead sys.stderr.write("completed in %g seconds\n" %(time.clock()-startTime))

Other scripts also contain time.clock():

diploSHIC/makeFeatureVecsForChrArmFromVcfDiploid.py: startTime = time.cloc() diploSHIC/makeFeatureVecsForChrArmFromVcfDiploid.py: sys.stderr.write("completed in %g seconds\n" %(time.clock()-startTime)) diploSHIC/makeFeatureVecsForChrArmFromVcf_ogSHIC.py: startTime = time.clock() diploSHIC/makeFeatureVecsForChrArmFromVcf_ogSHIC.py: sys.stderr.write("took %s seconds\n" %(time.clock()-startTime)) diploSHIC/makeFeatureVecsForChrArmFromVcf_ogSHIC.py:startTime = time.clock() diploSHIC/makeFeatureVecsForChrArmFromVcf_ogSHIC.py:sys.stderr.write("completed in %g seconds\n" %(time.clock()-startTime)) diploSHIC/makeFeatureVecsForSingleMsDiploid.py:start = time.clock() diploSHIC/makeFeatureVecsForSingleMsDiploid.py: sys.stderr.write("finished %d reps after %f seconds\n" %(numInstancesDone, time.clock()-start)) diploSHIC/makeFeatureVecsForSingleMsDiploid.py:sys.stderr.write("total time spent calculating summary statistics and generating feature vectors: %f secs\n" %(time.clock()-start)) diploSHIC/makeFeatureVecsForSingleMs_ogSHIC.py:start = time.clock() diploSHIC/makeFeatureVecsForSingleMs_ogSHIC.py: time.clock()-start))

molpopgen commented 3 years ago

This just hit me, too. Any time line for merging a fix?

andrewkern commented 3 years ago

yeah definitely