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

Import Error #83

Open isnmn opened 9 months ago

isnmn commented 9 months ago

Hi, I installed by cloning from git successfully. But when I try to run :

python ~/MAIN/tools/pcangsd/pcangsd/pcangsd.py --beagle GL.beagle.gz --threads 20

Returns:

PCAngsd v1.2
Jonas Meisner and Anders Albrechtsen.
Using 20 thread(s).

Traceback (most recent call last):
  File "/export/home4/2762262d/MAIN/tools/pcangsd/pcangsd/pcangsd.py", line 550, in <module>
    main()
  File "/export/home4/2762262d/MAIN/tools/pcangsd/pcangsd/pcangsd.py", line 145, in main
    from pcangsd import admixture
ImportError: cannot import name 'admixture' from 'pcangsd' (/export/home4/2762262d/MAIN/tools/pcangsd/pcangsd/pcangsd.py)

Could you help please?

Rosemeis commented 9 months ago

Hi,

When you have installed pcangsd, it should be run in the following way: pcangsd --beagle GL.beagle.gz --threads 20

Best, Jonas

VBieker commented 9 months ago

Hi,

I installed pcangsd following the instructions here and it said the installation finished successfully. But I can't run it with pcangsd --beagle GL.beagle.gz --threads 20, I get a "command not found" error. When I try to run it like this python3 pcangsd.py, I get the same error as isnmn.

Any ideas why the installation doesn't seem to create the executable? I also tried with pip3 install --user .

Best, Vanessa

emrullahub commented 9 months ago

Hi, I have experienced this issue myself. Just write pip3 install -e . in the directory where the program is located. (/home/emr/pcangsd/), It gives a warning WARNING: The script pcangsd is installed in '/home/emr/.local/bin which is not on PATH."

Then you write an alias to ~/.bashrc for this location.

Golyashah commented 9 months ago

I am having the same issue. I used the instruction in http://www.popgen.dk/software/index.php/PCAngsd and used: python pcangsd.py -beagle input.beagle.gz -out output -threads 64 but I am getting this error: ImportError: cannot import name 'admixture' from 'pcangsd' (/home/kgbeaty/Data_kgbeaty/Herons/PCAngsd/pcangsd/pcangsd/pcangsd.py)

When I try pcangsd as a code, it says this code does not exist

Rosemeis commented 9 months ago

Unfortunately the instructions in http://www.popgen.dk/software/index.php/PCAngsd are very outdated! The info here on GitHub is up to date.

When installed, you should be able to run PCAngsd using a simple pcangsd command (notice no python). I guess an issue can arise when you install without an environment (conda or venv) on a cluster, where the install location is not part of your PATH (as mentioned by @emrullahub). Please check "~/.local/bin" and update your PATH if needed.

Best, Jonas

VBieker commented 9 months ago

Thank you! It works now for me :)

Best, Vanessa

madzafv commented 3 months ago

Hi, I'm getting the same error trying to run it on a cluster. python pcangsd.py -beagle input.beagle.gz -out output -threads 64 but I am getting this error: ImportError: cannot import name 'admixture' from 'pcangsd'

I've already added these two paths to my ~/.bash_profile PATH=$PATH:$HOME/.local/bin PATH=$PATH:$HOME/data/mfariasv/install/pcangsd/pcangsd

but the error persists.

What could be wrong? Thank you

jsoghigian commented 2 months ago

Hi all - We were having this issue here, various solutions above helped for different users. We are working on a cluster, so installing it into an environment anyone could use was tricky.

For personal use, when in a conda environment a user has write access to, we found this command set from the github front page worked well: git clone https://github.com/Rosemeis/pcangsd.git cd pcangsd pip3 install .

We were then able to run the program without trouble. For us, we had to be in the directory that contained the various install components for it to work correctly as referenced above.