Open bensutherland opened 8 months ago
I'm having the exact same problem, was a solution found?
Hi @alleneli , Unfortunately no, I did not find a solution, and was not able to get the program to install.
Shoot, I tried reverting to an older version of Cython that tends to work better with Python 2, but that led to another suite of issues.
If I make any progress I will report back here.
I found a workaround, someone created this: https://structure-threader.readthedocs.io/en/latest/ and it works perfectly in my M1 Mac.
Awesome, thank you @pkmnsandy!
in parse_bed.pyx you need to put : Nbytes = Nindiv//4+(Nindiv%4>0)1 (double //), not Nbytes = Nindiv/4+(Nindiv%4>0)1, then in each .py file put print ( ), i.e. parentheses in each print
Original poster was using python 2, but if you are using python 3, you can try https://github.com/jashapiro/fastStructure/tree/py3 This fix wasn't incorporated into the main branch. But even with this py3 branch, I had to fix a couple additional things which David919110 suggested (missing parentheses for print () in fastStructure.pyx and parse_bed.pyx and specify integer division // instead of / in parse_bed.pyx. Here is the patch: fastStructure-py3.print.intDiv.patch :
diff -ru fastStructure-19e39d1161c2eb49e6137d2ab2449888bd04f7ec.orig/fastStructure.pyx fastStructure-19e39d1161c2eb49e6137d2ab2449888bd04f7ec/fastStructure.pyx
--- fastStructure-19e39d1161c2eb49e6137d2ab2449888bd04f7ec.orig/fastStructure.pyx 2015-10-15 12:34:35.000000000 -0800
+++ fastStructure-19e39d1161c2eb49e6137d2ab2449888bd04f7ec/fastStructure.pyx 2024-08-14 15:07:09.923564488 -0800
@@ -302,7 +302,7 @@
if not len(newmasks)>=cv:
wellmasked = False
- print "Failed"
+ print("Failed")
masks = newmasks[:cv]
meandeviance = np.zeros((cv,), dtype=float)
diff -ru fastStructure-19e39d1161c2eb49e6137d2ab2449888bd04f7ec.orig/parse_bed.pyx fastStructure-19e39d1161c2eb49e6137d2ab2449888bd04f7ec/parse_bed.pyx
--- fastStructure-19e39d1161c2eb49e6137d2ab2449888bd04f7ec.orig/parse_bed.pyx 2015-10-15 12:34:35.000000000 -0800
+++ fastStructure-19e39d1161c2eb49e6137d2ab2449888bd04f7ec/parse_bed.pyx 2024-08-14 15:07:17.109669878 -0800
@@ -22,7 +22,7 @@
Nindiv = i+1
# Number of bytes to read in at a time
- Nbytes = Nindiv/4+(Nindiv%4>0)*1
+ Nbytes = Nindiv//4+(Nindiv%4>0)*1
# number of SNPs
handle = open(file+'.bim','r')
@@ -45,7 +45,7 @@
checkC = bin(struct.unpack('<B', line)[0])[2:].zfill(8)[::-1]
if checkA!="00110110" or checkB!="11011000":
- print "This is not a valid bed file"
+ print("This is not a valid bed file")
handle.close()
sys.exit(2)
I am having trouble installing fastStructure (cloned today) on a MacOS (Ventura 13.5). I've followed all instructions from the README, and have installed all necessary dependencies. I can give details if needed, or if that would help please let me know.
The crash occurs when trying to compile the main cython scripts. Error message:
Some details: python /Library/Frameworks/Python.framework/Versions/2.7/bin/python2 GSL-2.7 installed from gnu.org numpy installed by pip Cython installed by pip /Library/Frameworks/Python.framework/Versions/2.7/bin/Cython
Thank you for any help.