cjlin1 / liblinear

LIBLINEAR -- A Library for Large Linear Classification
https://www.csie.ntu.edu.tw/~cjlin/liblinear/
BSD 3-Clause "New" or "Revised" License
1k stars 343 forks source link

Cannot import even after make #68

Closed adityapatruni closed 3 years ago

adityapatruni commented 3 years ago

I am trying to use liblinear for python. I use Ubuntu 20.04 and I ran make in the python folder.

I’m trying to import it by running from liblinearutil import * However, I am still unable to successfully import it outside the liblinear directory. How can I fix this? Thank you

cjlin1 commented 3 years ago

I think you need to use sys.path.append to add liblinear directory path so you can call liblinear from other places

On 2020-10-12 11:15, Aditya Patruni wrote:

I am trying to use liblinear for python. I use Ubuntu 20.04 and I ran make in the python folder.

I’m trying to import it by running from liblinearutil import * However, I am still unable to successfully import it outside the liblinear directory. How can I fix this? Thank you

-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/cjlin1/liblinear/issues/68", "url": "https://github.com/cjlin1/liblinear/issues/68", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/cjlin1/liblinear/issues/68 [2] https://github.com/notifications/unsubscribe-auth/ABI3BHUSWCIHRE6DKRWWXZ3SKJYDRANCNFSM4SMHL6OA

adityapatruni commented 3 years ago

I think you need to use sys.path.append to add liblinear directory path so you can call liblinear from other places On 2020-10-12 11:15, Aditya Patruni wrote: I am trying to use liblinear for python. I use Ubuntu 20.04 and I ran make in the python folder. I’m trying to import it by running from liblinearutil import * However, I am still unable to successfully import it outside the liblinear directory. How can I fix this? Thank you -- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "#68", "url": "#68", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ] Links: ------ [1] #68 [2] https://github.com/notifications/unsubscribe-auth/ABI3BHUSWCIHRE6DKRWWXZ3SKJYDRANCNFSM4SMHL6OA

I have done that but the issue still stays. I have noticed that the python folder does not contain an init.py file inside. Is this how it should be? If not, where can I find the init.py file so I can add it to the directory

cjlin1 commented 3 years ago

there is no init.py I can run it without problem. Could you show me how you did it?

On 2020-10-12 14:09, Aditya Patruni wrote:

I think you need to use sys.path.append to add liblinear directory path so you can call liblinear from other places … On 2020-10-12 11:15, Aditya Patruni wrote: I am trying to use liblinear for python. I use Ubuntu 20.04 and I ran make in the python folder. I’m trying to import it by running from liblinearutil import * However, I am still unable to successfully import it outside the liblinear directory. How can I fix this? Thank you -- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. [ { @.": "HTTP://SCHEMA.ORG", @.": "EmailMessage", "potentialAction": { @.": "VIEWACTION", "TARGET": "#68 [1]", "URL": "#68 [1]", "NAME": "VIEW ISSUE" }, "DESCRIPTION": "VIEW THIS ISSUE ON GITHUB", "PUBLISHER": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ] Links: ------ [1] #68 [1] [2]

https://github.com/notifications/unsubscribe-auth/ABI3BHUSWCIHRE6DKRWWXZ3SKJYDRANCNFSM4SMHL6OA

I have done that but the issue still stays. I have noticed that the python folder does not contain an INIT.py file inside. Is this how it should be? If not, where can I find the INIT.py file so I can add it to the directory

-- You are receiving this because you commented. Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/cjlin1/liblinear/issues/68#issuecomment-706889268", "url": "https://github.com/cjlin1/liblinear/issues/68#issuecomment-706889268", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/cjlin1/liblinear/issues/68 [2] https://github.com/cjlin1/liblinear/issues/68#issuecomment-706889268 [3] https://github.com/notifications/unsubscribe-auth/ABI3BHSS3IPCFQGFBENRSELSKKMTLANCNFSM4SMHL6OA

adityapatruni commented 3 years ago

Apologies, there was an error in the path I used. It is working now. Thank you. For anyone else facing this issue, you can add the liblinear directory to the PYTHONPATH in the .bashrc file.