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

importing pyxdameraulevenshtein crashes python kernel #11

Closed
funkindy opened this issue Apr 4, 2018 · 13 comments
Closed

importing pyxdameraulevenshtein crashes python kernel #11

funkindy opened this issue Apr 4, 2018 · 13 comments

Comments

@funkindy
Copy link

funkindy commented Apr 4, 2018

Windows 10, Python 3.5, pyxdameraulevenshtein v1.5

I get "Kernel died, restarting" anytime i execute this line (in separate venv):

import pyxdameraulevenshtein

Seems like OS issue.

@gfairchild
Copy link
Collaborator

gfairchild commented Apr 4, 2018

How did you install it? Did the pip install succeed? I haven't actually tried installing this on Windows 10 except for within the bash subsystem (which does work).

@funkindy
Copy link
Author

funkindy commented Apr 5, 2018

I have installed it vie pip as the dependency of textdistance package (i opened an issue there but they forwarded me here). So i just did this:

pip install textdistance[extras]

to install. And it succeded.

@gfairchild
Copy link
Collaborator

Can you try installing pyxdameraulevenshtein by itself using pip and let me know if that works?

@funkindy
Copy link
Author

funkindy commented Apr 5, 2018

Same crash on import after pip install pyxdameraulevenshtein on clean venv.

@gfairchild
Copy link
Collaborator

Would you mind creating a fresh virtual environment and installing with the following command?:

pip install --verbose pyxdameraulevenshtein

Please paste the contents of that output here so that I can get a little more insight into what's going on.

@funkindy
Copy link
Author

funkindy commented Apr 9, 2018

@gfairchild i created fresh venv and installed with --verbose. Got this suspicious error:

--- Logging error ---
Traceback (most recent call last):
File "c:\users\user\anaconda3\Lib\logging_init_.py", line 983, in emit
stream.write(self.terminator)
File "c:\users\user\envs\new\lib\site-packages\pip_vendor\colorama\ansitowin32.py", line 141, in write
self.write_and_convert(text)
File "c:\users\user\envs\new\lib\site-packages\pip_vendor\colorama\ansitowin32.py", line 169, in write_and_convert
self.write_plain_text(text, cursor, len(text))
File "c:\users\user\envs\new\lib\site-packages\pip_vendor\colorama\ansitowin32.py", line 174, in write_plain_text
self.wrapped.write(text[start:end])
OSError: raw write() returned invalid length 4 (should have been between 0 and 2)
Call stack:
File "c:\users\user\anaconda3\Lib\runpy.py", line 184, in run_module_as_main
"main", mod_spec)
File "c:\users\user\anaconda3\Lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\user\Envs\new\Scripts\pip.exe_main
.py", line 9, in
sys.exit(main())
File "c:\users\user\envs\new\lib\site-packages\pip_init
.py", line 248, in main
return command.main(cmd_args)
File "c:\users\user\envs\new\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\user\envs\new\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\users\user\envs\new\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\users\user\envs\new\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\users\user\envs\new\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "c:\users\user\envs\new\lib\site-packages\pip\wheel.py", line 273, in move_wheel_files
logger.debug(stdout.getvalue())
Message: ''
Arguments: ()

But afterall "Successfully installed numpy-1.14.2 pyxdameraulevenshtein-1.5".

@gfairchild
Copy link
Collaborator

Is that the complete output of pip install?

Ok, so from what I can tell right now, it looks like the error is in the installation, not the use, of pyxdameraulevenshtein. We need to figure out how to be able to get you to install this on Windows. As indicated on the readme, you need to be able to compile C code. On Linux/Macs, this is easy. Using the Bash subsystem on Windows (which I'd highly recommend checking out if you haven't already), this is easy. I've never tried it on native Windows, though. Additionally, it looks like you're using Anaconda, which I've also never used, so I'm not sure how that affects things.

https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.0_standalone:_Build_Tools_for_Visual_Studio_2017_.28x86.2C_x64.2C_ARM.2C_ARM64.29 may be a good place to start. So, as those instructions say, try this:

  1. Install Microsoft Build Tools for Visual Studio 2017.
  2. pip install --upgrade setuptools
  3. pip install --verbose pyxdameraulevenshtein

Let me know if that solves your problem.

@funkindy
Copy link
Author

After i cloned the repo and installed from source (python setup.py install) i now get all the things work good. Also there is no crash on import pyxdameraulevenshtein as well. It is good in both clean venv and any existing venv as well.

So maybe the bug is somewhere in pypi version difference?

@gfairchild
Copy link
Collaborator

That's certainly interesting. The PyPI version is identical to master right now. Nothing has changed. So after trying what I just suggested, you still can't install from PyPI?

@funkindy
Copy link
Author

New scenario appeared:

  1. I cleaned up all the pip cache
  2. pip install --verbose pyxdameraulevenshtein. Full log of this is attached. But this time numpy was not installed as a dependency. So after import pyxdameraulevenshtein i just got ImportError: no module called numpy
  3. pip install numpy v1.14.2 is installed.
  4. Now everything works good.

So if my cached numpy was broken i dont get why installing pyxdameraulevenshtein from source didnt cause the issue.

install_log.txt

@gfairchild
Copy link
Collaborator

gfairchild commented Apr 11, 2018

Very interesting. NumPy should automatically be installed, but that's clearly not the case. In fact, I just tried it on an empty virtual environment on my PC (using the Ubuntu subsystem on Windows 10), and I can replicate what you're referring to.

I need to fix setup.py so that NumPy is properly installed by pip if it's not already there. I'm currently essentially doing what https://stackoverflow.com/a/21621689/1269634 suggests, but that's clearly not working.

@gfairchild
Copy link
Collaborator

gfairchild commented Jan 4, 2019

I just modified setup.py a bit to actually remove some NumPy-related code that seemed to be causing various issues. I've made the decision to expect the user to explicitly install NumPy prior to installing this library. 1.5.1 is now live on PyPI. I think this will fix your issue. Can you try and let me know?

@gfairchild
Copy link
Collaborator

1.5.2 was just released, which further addresses the NumPy dependency issue. I think this should solve your problem. I'm going to go ahead and close this issue, but please let me know if you're still experiencing this problem with 1.5.2.

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