netZoo / netZooPy

netZooPy is a network biology package implemented in Python.
https://netzoo.github.io/
GNU General Public License v3.0
77 stars 35 forks source link

Error using netZooPY and PyPanda with toydata #47

Closed SalvatoreRa closed 4 years ago

SalvatoreRa commented 4 years ago

Hi,

I have anaconda, python 3.7, and windows 10.

I installed netzoopy through conda:

git clone https://github.com/netZooPy/netZooPy.git
cd netZooPy
py -3 setup.py install

I followed the vignette to test the library: https://github.com/netZoo/netZooPy/blob/master/UserGuide.md

I used py -3 instead python3, since it not recognized python 3 (but up to my knowledge should be the same).

from pypanda.panda import Panda
from pypuma.puma import Puma
from pypanda.lioness import Lioness

I encoutered an error trying to import Puma:

ModuleNotFoundError: No module named 'pypuma'

panda and Lioness were imported without issues.

then: panda_obj = Panda('../../tests/ToyData/ToyExpressionData.txt', '../../tests/ToyData/ToyMotifData.txt', '../../tests/ToyData/ToyPPIData.txt', remove_missing=False)

generated issues with the file localization. I updated the localization:

expression_data='netZooPy/tests/ToyData/ToyExpressionData.txt'
motif_data='netZooPy/tests/ToyData/ToyMotifData.txt'
ppi_data='netZooPy/tests/ToyData/ToyPPIData.txt'

panda_obj = Panda(expression_data, motif_data, ppi_data, remove_missing=False)

this is resulting in the following error:

File "", line 1, in panda_obj = Panda(expression_data, motif_data, ppi_data, remove_missing=False)

File "C:\Users\Bio03\Anaconda3\lib\site-packages\pypanda-0.1-py3.7.egg\pypanda\panda.py", line 31, in init self.__motif_data_to_matrix()

File "C:\Users\Bio03\Anaconda3\lib\site-packages\pypanda-0.1-py3.7.egg\pypanda\panda.py", line 83, in __motif_data_to_matrix idx = np.ravel_multi_index((idx_tfs, idx_genes), self.motif_matrix.shape)

TypeError: Iterator operand or requested dtype holds references, but the REFS_OK flag was not enabled

I read online that this issue can arise from the fact the files are not in the correct but If I use pd.read_csv I can load the individual files.

how I can salve it?

Thank you very much for your help

marouenbg commented 4 years ago

Hi @SalvatoreRa , Thanks for spotting this out the call to netzoo is

from netZooPy.panda.panda import Panda
from netZooPy.puma.puma import Puma
from netZooPy.lioness.lioness import Lioness

Let me know how it goes, I will update the readme file.

marouenbg commented 4 years ago

And to install netZooPy, please follow the updated guide here

https://netzoopy.readthedocs.io/en/latest/install/index.html

marouenbg commented 4 years ago

Actually, you can follow this Jupyter notebook to get started

https://github.com/netZoo/netZooPy/tree/master/tutorial/panda

SalvatoreRa commented 4 years ago

thank you for your answer

I have downloaded the ipynb and imported in Jupyter.

I used the installation with conda:

source activate myenv
conda install git pip
pip install git+git://github.com/netZoo/netZooPy.git

the source comand was not recognized and gave issued. Indeed, I use the anacond powershell prompt to install :

conda install git pip
pip install git+git://github.com/netZoo/netZooPy.git

no error arose during this process.

I restarted the kernel in Jupyter and then executed the following cells:

import os
# os.getcwd()
# os.chdir("~/")
os.getcwd()

when I executed:

from netZooPy.panda.panda import Panda
import pandas as pd
import matplotlib.pyplot as plt

I received this error:

ImportError Traceback (most recent call last)

in ----> 1 from netZooPy.panda.panda import Panda 2 import pandas as pd 3 import matplotlib.pyplot as plt ~\Anaconda3\lib\site-packages\netZooPy\__init__.py in 1 from __future__ import absolute_import 2 ----> 3 from netZooPy import panda 4 from netZooPy import puma 5 fromz netZooPy import lioness ImportError: cannot import name 'panda' from 'netZooPy' (C:\Users\Bio03\Anaconda3\lib\site-packages\netZooPy\__init__.py)
marouenbg commented 4 years ago

Hi @SalvatoreRa , The installation with conda is untested. Could you please try installing with pip3 as suggested here https://netzoopy.readthedocs.io/en/latest/install/index.html

Please let me know how it goes!

SalvatoreRa commented 4 years ago

I installed ubuntu for windows, and after reinstalling different packages, and then I have installed through pip3

but I received this error:


ImportError Traceback (most recent call last)

in ----> 1 from netZooPy.panda.panda import Panda 2 import pandas as pd 3 import matplotlib.pyplot as plt ~\Anaconda3\lib\site-packages\netZooPy\__init__.py in 1 from __future__ import absolute_import 2 ----> 3 from netZooPy import panda 4 from netZooPy import puma 5 from netZooPy import lioness ImportError: cannot import name 'panda' from 'netZooPy'
marouenbg commented 4 years ago

So the error points to your distribution of conda ~\Anaconda3\lib\site-packages\netZooPy_init_.py, which means that you are not using the pip installation. Could you please

conda remove netZooPy

Then in netZooPy root

pip3 install -e .

and let me know how it goes!

Thanks @SalvatoreRa

SalvatoreRa commented 4 years ago

thank you for your quick reply and your help, I tried different things before replying

I used conda remove netZooPy in the terminal:

Solving environment: failed

PackagesNotFoundError: The following packages are missing from the target environment:

  • netzoopy

when I check using pip list I found netZooPy 0.1.1 present.

pip uninstall netZooPy

Instead it works and successfully unistalls netzoopy I have run again the jupyter code:

%%bash
cd ~
git clone https://github.com/netZoo/netZooPy.git
cd netZooPy
pip3 install -e .

and then:

from netZooPy.panda.panda import Panda
import pandas as pd
import matplotlib.pyplot as plt

but this lead to an error:

ModuleNotFoundError Traceback (most recent call last)

in ----> 1 from netZooPy.panda.panda import Panda 2 import pandas as pd 3 import matplotlib.pyplot as plt ModuleNotFoundError: No module named 'netZooPy.panda' actually using pip list was not showing netZooPy installed. I tried also: `pip install git+https://github.com/netZoo/netZooPy.git` which actually is creating a folder in the anaconda site package and I see is installed using pip list. I tried to dig a bit more. what I noticed: conda, pip + git are all creating a folder in > C:\Users\Bio03\Anaconda3\lib\site-packages\ while actually the bash approach is creating a folder in C:\Users\Bio03\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\Bio03 the two folder have identical name but the folder generated in the anaconda folder but they are slightly different.
marouenbg commented 4 years ago

Hi @SalvatoreRa , Here is my Skype: marouenbg Can you meet today at 6 pm CET time? Otherwise what time works for you best? See you

SalvatoreRa commented 4 years ago

HI thank you, I just noticed.

I cannot at 6 PM, but tomorrow I am available at any time after 9:30 CET am let me know

marouenbg commented 4 years ago

How about tomorrow at 6pm CET time?

dcolinmorgan commented 4 years ago

thank you for your quick reply and your help, I tried different things before replying

I used conda remove netZooPy in the terminal:

Solving environment: failed PackagesNotFoundError: The following packages are missing from the target environment:

  • netzoopy

when I check using pip list I found netZooPy 0.1.1 present.

pip uninstall netZooPy

Instead it works and successfully unistalls netzoopy I have run again the jupyter code:

%%bash
cd ~
git clone https://github.com/netZoo/netZooPy.git
cd netZooPy
pip3 install -e .

and then:

from netZooPy.panda.panda import Panda
import pandas as pd
import matplotlib.pyplot as plt

but this lead to an error:

ModuleNotFoundError Traceback (most recent call last) in ----> 1 from netZooPy.panda.panda import Panda 2 import pandas as pd 3 import matplotlib.pyplot as plt

ModuleNotFoundError: No module named 'netZooPy.panda'

actually using pip list was not showing netZooPy installed.

I tried also:

pip install git+https://github.com/netZoo/netZooPy.git

which actually is creating a folder in the anaconda site package and I see is installed using pip list.

I tried to dig a bit more.

what I noticed:

conda, pip + git are all creating a folder in

C:\Users\Bio03\Anaconda3\lib\site-packages\

could you check if the files are actually .py files are copied here, or if the folder is empty?

while actually the bash approach is creating a folder in

C:\Users\Bio03\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\Bio03

same here

the two folder have identical name but the folder generated in the anaconda folder but they are slightly different.

SalvatoreRa commented 4 years ago

@marouenbg it is fine for me, thank you

SalvatoreRa commented 4 years ago

@dcolinmorgan this is what there is the folder:

C:\Users\Bio03\Anaconda3\lib\site-packages\

1

instead this what is in the folder:

C:\Users\Bio03\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\Bio03

2

marouenbg commented 4 years ago

@SalvatoreRa please add me in skype

SalvatoreRa commented 4 years ago

@marouenbg I wrote you on skype

marouenbg commented 4 years ago

problem solved through using python3 in Ubuntu. NetZooPy does not currently support conda installation from Windows.