Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: unexpected symbol in "args <- paste("-m venv", my_env) gensim" #1

Open
amacanovic opened this issue Nov 21, 2019 · 8 comments
Open

Comments

@amacanovic
Copy link

Hello all,

When running the code specified, I am getting the following error message
Error: unexpected symbol in "args <- paste("-m venv", my_env) gensim"

I am very good with reticulate yet, so I'd appreciate any help!

Thank you very much!

@JohnCoene
Copy link
Member

Sorry the package is not really maintained currently, I hope to develop it further soon.

I have corrected the instructions in the README.

my_env <- "./env"

# run this (works on unix)
args <- paste("-m venv", my_env) 
system2("python3", args) # create environment
reticulate::use_virtualenv(my_env) # force reticulate to use env
# install textblob in environment
textblob::install_textblob(my_env)

Does the above work?

@amacanovic
Copy link
Author

amacanovic commented Nov 21, 2019 via email

@JohnCoene
Copy link
Member

Funny this happens, I'm not sure why. The virtual environment is actually recommended but not necessary. Installing straight should work. Would you mind trying?

textblob::install_textblob()

Also, have you had any such issues with other python/reticulate packages?

@amacanovic
Copy link
Author

amacanovic commented Nov 22, 2019 via email

@JohnCoene
Copy link
Member

JohnCoene commented Nov 22, 2019

I'm afraid I'm unsure what the issue but just so you know reticulate has been difficult for me to fully understand too.

One thing that helped on my side was to find the path to the python installation, in R with Sys.which("python"), then specify this path in reticulate::use_python("/usr/local/bin/python") before even loading textblob.

reticulate::use_python("/usr/local/bin/python")

library(textblob)

Then again, I wouldn't want to waste your time. textblob is really not properly integrated in this package and so might not be worth the trouble.

@JohnCoene
Copy link
Member

Any luck?

@amacanovic
Copy link
Author

Dear John,

Very sorry for the lack of updates! Got a bit busy with some other projects.

I have cleaned up my python installations and tried again.
This time I managed to install text blob in my environment.
However, once I try to run
textblob::download_corpora()
I get the the following error:
Error: Python module textblob was not found.

Which I find strange, because if I try to go into this environment manually and install textblob with a python command, I get the message that it is already installed.

Sorry to bother you again, but any ideas what might be going wrong here?
Thanks!!

@amacanovic
Copy link
Author

An update; I have, in fact, managed to get it running!
Inputting a single string and analyzing get the right results :)

However, I am struggling to understand how could I import, for example, as CSV file with multiple documents into textblob. I assumed using apply function could help, but not very clear how to do this in R.

If I try a simple text_blob(df$column) I get, to no surprise, this error
Error in py_call_impl(callable, dots$args, dots$keywords) : TypeError: The textargument passed to '__init__(text)' must be a string, not <class 'list'>

Not sure how to get around this in R?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants