natekupp / ffx

Fast Function Extraction
http://trent.st/ffx
Other
80 stars 97 forks source link

No module named 'api' #20

Closed hfl15 closed 8 years ago

hfl15 commented 8 years ago

I follow the tutorial to install ffx. But when I import ffx one problem arising and the error information as follow:

In [1]: import ffx

ImportError Traceback (most recent call last)

in () ----> 1 import ffx E:\Program Files\Anaconda3\lib\site-packages\ffx__init__.py in () ----> 1 from api import * ImportError: No module named 'api' --- How do I fix this problem? My python version is 3.5.1. Really appreciate!!
jmmcd commented 8 years ago

What steps did you follow to install ffx? I'm not familiar with any tutorial.

This filepath looks strange to me: Anaconda3\lib\site-packages\ffx__init__.py -- I'm on OSX though.

hfl15 commented 8 years ago

I’m on windows 10 and use python by installing anaconda. I follow the readme.md file of this project. First of all, I install ffx by command: pip install ffx I search the installing directory, the relevant file are assigned into several different folder, as follow:

e:\program files\anaconda3\lib\site-packages\ffx-1.3.4.dist-info\description.rst e:\program files\anaconda3\lib\site-packages\ffx-1.3.4.dist-info\installer e:\program files\anaconda3\lib\site-packages\ffx-1.3.4.dist-info\metadata e:\program files\anaconda3\lib\site-packages\ffx-1.3.4.dist-info\metadata.json e:\program files\anaconda3\lib\site-packages\ffx-1.3.4.dist-info\record e:\program files\anaconda3\lib\site-packages\ffx-1.3.4.dist-info\top_level.txt e:\program files\anaconda3\lib\site-packages\ffx-1.3.4.dist-info\wheel e:\program files\anaconda3\lib\site-packages\ffxinit.py e:\program files\anaconda3\lib\site-packages\ffxpycache__init.cpython-35.pyc e:\program files\anaconda3\lib\site-packages\ffxpycache\api.cpython-35.pyc e:\program files\anaconda3\lib\site-packages\ffx\api.py e:\program files\anaconda3\lib\site-packages\ffx\core.py e:\program files\anaconda3\lib\site-packages\testsinit.py e:\program files\anaconda3\lib\site-packages\testspycache__init.cpython-35.pyc e:\program files\anaconda3\lib\site-packages\testspycache\tests.cpython-35.pyc e:\program files\anaconda3\lib\site-packages\tests\tests.py e:\program files\anaconda3\scripts\runffx

I try the simple example you pose at the readme.md file, but fail. So what’s the problem?

jmmcd commented 8 years ago

I see. I didn't realise you meant pip.

The pip version won't work on Python 3, because of some changes in importing. I don't have write access to pip for ffx, so I'll have to leave that to @natekupp.

For now, you could install by cloning the repo and using sudo python setup.py install.

hfl15 commented 8 years ago

Hi jmmcd: Thank you for your kindness. The last time, I install and test the ffx on python 3.5.1 lead to lots of errors. I found that something error due to inappropriate python version. So I do the same thing based on python 2.7.12. But when I run the Python Module you posed at the Readme.md, there is still one problem as follow: _Traceback (most recent call last): File "F:/PycharmProjects/symbolic/main.py", line 10, in models = ffx.run(train_X, train_y, test_X, test_y, ["predictor_a", "predictor_b"]) File "E:\Program Files\Anaconda3\envs\python2\lib\site-packages\ffx\api.py", line 4, in run return core.MultiFFXModelFactory().build(train_X, train_y, test_X, test_y, varnames, verbose) File "E:\Program Files\Anaconda3\envs\python2\lib\site-packages\ffx\core.py", line 559, in build next_models = FFXModelFactory().build(train_X, train_y, ss, varnames, verbose) File "E:\Program Files\Anaconda3\envs\python2\lib\site-packages\ffx\core.py", line 711, in build ss, varnames, order1_bases, X, y, max_num_bases, target_train_nmse, verbose) File "E:\Program Files\Anaconda3\envs\python2\lib\site-packages\ffx\core.py", line 831, in _basesToModels max_num_bases, target_train_nmse, verbose) File "E:\Program Files\Anaconda3\envs\python2\lib\site-packages\ffx\core.py", line 884, in _pathwiseLearn clf.fit(X_unbiased, y_unbiased) File "E:\Program Files\Anaconda3\envs\python2\lib\site-packages\ffx\core.py", line 1033, in newf old = signal.signal(signal.SIGALRM, handler) AttributeError: 'module' object has no attribute 'SIGALRM'

I don’t know what’s wrong happen. What does the attribute 'SIGALRM' mean? Really hope to get your help. Thank you very much!

jmmcd commented 8 years ago

@hfl15 This relates to #17. There is some code there that gives a workaround that may work for you. But I don't have Windows.

BTW FFX should now be working for both Python 2 and 3, both in Github and pip.

hfl15 commented 8 years ago

Thank you for your help. I have succeed to test FFX on ubuntu.