Rosemeis / pcangsd

Framework for analyzing low depth NGS data in heterogeneous populations using PCA.
GNU General Public License v3.0
46 stars 11 forks source link

Cythonized pcangsd.py not working #61

Closed emrullahub closed 2 years ago

emrullahub commented 2 years ago

Hi, i did cythonize process with this code "python3 setup.py build_ext --inplace" but i am getting the following error when im trying to do pca with test data on pcangsd website:

PCAngsd v.1.10. Jonas Meisner and Anders Albrechtsen. Using 64 thread(s).

Traceback (most recent call last): File "pcangsd/pcangsd/pcangsd.py", line 455, in main() File "pcangsd/pcangsd/pcangsd.py", line 148, in main from pcangsd import reader_cy ImportError: cannot import name 'reader_cy' from 'pcangsd' (/home/emr/pcangsd/pcangsd/pcangsd.py)

Can you help me how to solve it? Thanks, Emrullah

Mon 07 Mar 2022 03_08_16 PM +03

Rosemeis commented 2 years ago

Hi Emrullah,

The documentation on the website is a outdated in comparison to the newest PCAngsd version. So you would also need to do the following:

# Enter PCAngsd folder
cd pcangsd
pip3 install -e .

Now you should use PCAngsd by simply calling pcangsd --beagle path/input.gz --out test in the terminal. Let me know if that works.

Best, Jonas

emrullahub commented 2 years ago

Hi,

It worked, your code downloaded the pcangsd library.

Thank you, Emrullah

cnxiaobo94 commented 2 years ago

hello! Dear Rosemeis, I met the same problem that "reader_cy" cannot be imported. I tried your above suggestions, but it didn't work . Can you do me a favor? thanks IMG_2440

Rosemeis commented 2 years ago

This seems to be an issue with your systems compiler versions: https://github.com/stan-dev/pystan/issues/294

cnxiaobo94 commented 2 years ago

This seems to be an issue with your systems compiler versions: stan-dev/pystan#294

Thank you for your quick reply. I've probably read the link you gave. Because I'm not very good at CS and bioinfor., it looks a little difficult. overall, thank you for your reply. I'll try my best to solve it, or try it on another computer.

Rosemeis commented 2 years ago

No problem. :-) A potential fix could be by installing the following in your conda environment: conda install c-compiler cxx-compiler And then try to remove and reinstall pcangsd. Let me know if that works.

Best, Jonas

cnxiaobo94 commented 2 years ago

Thanks a lot! I installed these two packages you suggested, and reinstalled pcangsd. Your suggestions worked! thanks again for solving my problem. (sorry for late reply).

the steps for installing pcangsd

1.  conda install -c conda-forge c-compiler
2.  conda install -c conda-forge cxx-compiler
3.  git clone https://github.com/Rosemeis/pcangsd.git
4.  cd pcangsd/
5.  python setup.py build_ext --inplace
6.  pip install --user -r requirements.txt
7.  pip3 install -e .
Rosemeis commented 2 years ago

That is great to hear! :-)

AstridAlexAndersson commented 1 year ago

Hi @Rosemeis

I am having the exact same problem with cython, and I tried all the solutions suggested above (as well as installing cython separately, making a separate python environment aligning with the cython version) but none of these have worked for me...

When I run "pip install --user -r requirements.txt" the response is: "Requirement already satisfied: cython"

However, when I do the next step "pip3 install -e ." it says "ModuleNotFoundError: No module named 'Cython'"

I think this is why I try running pcangsd I get the error message "ImportError: cannot import name 'reader_cy' from 'pcangsd' "

Not sure how else to proceed....If you have any further guidance I would be super grateful for that!

Rosemeis commented 1 year ago

Hi @AstridAlexAndersson

I think it might be due to two different python installations, where "pip" and "pip3" is calling different ones. Can you try reinstalling while using the first step with "pip3":

git clone https://github.com/Rosemeis/pcangsd.git
cd pcangsd
pip3 install --user -r requirements.txt
python setup.py build_ext --inplace
pip3 install -e .

Best, Jonas

AstridAlexAndersson commented 1 year ago

Hi Jonas,

Thank you for your suggestion. I agree it must be some sort of version mismatch, but when I tried reinstalling with pip3 I still receive the same errors ☹

Greatly appreciate your input, Astrid

From: Jonas Meisner @.> Reply to: Rosemeis/pcangsd @.> Date: Friday, 19 May 2023 at 2:43 PM To: Rosemeis/pcangsd @.> Cc: @." @.>, Mention @.> Subject: Re: [Rosemeis/pcangsd] Cythonized pcangsd.py not working (Issue #61)

Hi @AstridAlexAnderssonhttps://github.com/AstridAlexAndersson

I think it might be due to two different python installations, where "pip" and "pip3" is calling different ones. Can you try reinstalling while using the first step with "pip3":

pip3 install --user -r requirements.txt

git clone https://github.com/Rosemeis/pcangsd.git

cd pcangsd

python setup.py build_ext --inplace

pip3 install -e .

Best, Jonas

— Reply to this email directly, view it on GitHubhttps://github.com/Rosemeis/pcangsd/issues/61#issuecomment-1554084601, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2BTV3MLSSBCYCKMPAJ5GYTXG4JALANCNFSM5QWGNIBA. You are receiving this because you were mentioned.Message ID: @.***>