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
cannot import name 'open' from 'smart_open' #489
Comments
What is the output of:
Here is the output I see on my system (different to yours) as an example:
|
The output is
|
Interesting. The I originally suspected this is some kind of Python 2 issue, but it works in a Py2 environment here without any problems:
|
I am not getting the open function in the smart_open directory. dir(smart_open) ['BZ2File', |
@Abhishek-Prajapat What smart_open version are you using? |
@Abhishek-Prajapat , I am also not able to see any open in the smart_open. I am, using the following versions The issue is that < 1.8.2 , the def open was actually def smart_open I solved it by writing my own version of glove2word2vec which is almost copy-paste
|
This issue doesn't appear to have been fixed in the latest versions Both 2.0.0 and 2.1.0 state that the Also, the list of exported functions I see from
My immediate issues with
|
@Auburngrads are you sure you're using the latest smart_open? My guess would be you have two (or more) instances of smart_open installed, perhaps in different virtual environments. And one of them is old ( Otherwise it's really weird. How did you install smart_open? Can you please uninstall it, re-install the latest version again and post the full installation log here (your installation command + all output until the installation completes)? |
@piskvorky possible that I would have multiple versions installed, but seems unlikely. Not using any virtual environments that I'm aware of and only have Removed and reinstalled Installation log file is attached. |
Thanks. When you open the file My MD5 hash of that file in release 2.1.0 is Alternatively, to check whether the same installed file is being imported, what does |
I do, yes.
I haven’t found anything in this file that I can attribute to why `open` would not be available.
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
From: Radim Řehůřek<mailto:notifications@github.com>
Sent: Wednesday, July 29, 2020 4:06 PM
To: RaRe-Technologies/smart_open<mailto:smart_open@noreply.github.com>
Cc: Jason Freels<mailto:Auburngrads@live.com>; Mention<mailto:mention@noreply.github.com>
Subject: Re: [RaRe-Technologies/smart_open] cannot import name 'open' from 'smart_open' (#489)
Thanks. When you open the file c:\users\aubur\appdata\local\r-mini~1\envs\r-reticulate\lib\site-packages\smart_open\smart_open_lib.py, do you see the line def open( there?
My MD5 hash of that file in release 2.1.0 is MD5 (smart_open_lib.py) = 5fcfed617811f6b63cd8ff44df118e83.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FRaRe-Technologies%2Fsmart_open%2Fissues%2F489%23issuecomment-665891741&data=02%7C01%7C%7C692a44f8e90345de09a808d833fae42b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637316499937941697&sdata=zdNIzQaUyWQup6HSEm3r6bsdXAg0ZwgzWWGCx53PdVg%3D&reserved=0>, or unsubscribe<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACCKCBPKIRZYHHX6GOJ2BT3R6B6MTANCNFSM4MRMVQVQ&data=02%7C01%7C%7C692a44f8e90345de09a808d833fae42b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637316499937941697&sdata=m2VLvI3fAsSCsYEiokYT12DJkgyHn4BhBsKLRodOgfY%3D&reserved=0>.
|
What does |
What's up with the |
The paths are the same, although anaconda prompt is truncating the printed path. This did highlight what my be my issue, though.
I interact with Python via Rstudio through an R package called reticulate. This is essentially a Python REPL that uses the `r-reticulate` environment by default (The non-truncated path is returned by the REPL). Up until this I’ve never seen a difference between the behavior of the reticulate REPL and that when I interact with Python directly.
I ran `from smart_open import open` in Python from the Anaconda Prompt -- without error. When attempted to verify this in spyder I needed to fix an issue with `qtpy`. After uninstalling and re-installing `qtpy` (and dependencies) everything works, both in Python and in the REPL.
I can only assume that a library required to establish the REPL became corrupted and caused the error.
|
Great, thanks for following up. I'm closing this ticket – the issue is with conflicting Python versions as expected, not For others stumbling on this ticket in the future: please check your environment Python paths as per above. Make sure the problem is not in your local setup. |
I am receiving the error
File "C:\ProgramData\Anaconda2\lib\site-packages\gensim\utils.py", line 45, in
from smart_open import open
ImportError: cannot import name open
I am using python 2.7.16, the gensim is in 3.8.2 and smart-open is 1.10.1. Any ideas of what is going on?
The text was updated successfully, but these errors were encountered: