question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python client fails to start when receiving info or warning message from imported python modules

See original GitHub issue

hi @kengz!

(hopefully I am not mistaken) it looks like client.py will fail to start and return an error as soon as any message is received, regardless of the type of message (warning, info, not necessarily errors).

Here is how I got to this conclusion:

  1. I grabbed the dnn_titanic_train.py (actually all AI scripts too) from AIVA v3 and brought them over to my local clone of AIVA v4
  2. I installed all required python modules in my virtual env, especially tensorflow with GPU support

==> When starting the node app (npm start --debug), I get the following: ERROR I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally

This actually not an error message, when starting a python console and running import tensorflow, several messages telling me the successfully loaded cuda libs. I can also run the MNIST training example from TF, etc.

So, to double-check it wasn’t caused by the GPU-TF version, I made another virtual env, this time with the CPU tensorflow version. Then I got warning messages from tensorflow: ERROR <...>/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 <...>, DeprecationWarning) which I took care of by upgrading the dnn_titanic_train.py code so that it works on tensorflow v0.11RC1 (also DNNClassifier class has changed, etc.).

Then I got another tensorflow warning I couldn’t get past: ERROR WARNING:tensorflow:float64 is not supported by many models, consider casting to float32 which should be released in the official tensorflow v0.11 (link to issue).

In theory, to make it work, I would have to go back to tensorflow v0.9 or earlier (provided I don’t encounter other warning messages). Also we can forget about the GPU tensorflow.

Bottomline, these messages are not error messages but are interpreted as such. Do you confirm this problem?

Thanks for your insight!

(btw, I’m on the cgkb branch but it shouldn’t matter I think)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
claviculecommented, Nov 1, 2016

You are probably onto something with this idea. I modified the src/start-io.js so that it launches the python3 of my virtualenv:

    lang = _.replace(lang, 'python3', PYPATH)
    global.log.info(`AYA Starting socketIO client for ${lang} at ${process.env.IOPORT}`) // you'll see below why I put AYA as a marker

and I got this output:

[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] DEBUG import js lib from client.js
[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] INFO Starting socketIO client for js at 6466
[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] INFO AYA Starting socketIO client for /path/to/virtualenv/python at 6466
[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] DEBUG Set TELEGRAM PORT: 8443
[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] DEBUG ngrok options: {
  "proto": "http",
  "addr": 8443,
  "authtoken": "XXX"
}
[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] INFO Starting socketIO client for python3 at 6466
[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] ERROR Traceback (most recent call last):
  File "/path/to/aiva/node_modules/spacy-nlp/src/client.py", line 12, in <module>
    import websocket
ImportError: No module named 'websocket'

[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] DEBUG js XXX joined, 3 remains
[Tue Nov 01 2016 16:14:30 GMT+0000 (utc)] ERROR An incompatible websocket library is conflicting with the one we need.
You can remove the incompatible library and install the correct one

Note that the client.py is properly started with the correct python env: AYA Starting socketIO client for /path/to/virtualenv/python at 6466

but then we see this one: Starting socketIO client for python3 at 6466

meaning it’s starting a new python process, using the default system env (which doesn’t have modules installed, hence the websocket import error). So the question is: where is this new python instruction starter coming from? I searched the entire AIVA directory for a logging that is Starting socketIO client for (and other variations) but couldn’t find anything except the explicit Starting socketIO client for js at here. I looked at other usage of the variable ioClientCmds without success either.

It must be coming from somewhere right?

0reactions
rojobuffalocommented, Mar 27, 2018

I’m running into something similar, but the proposed solution didn’t work for me.

When I follow install and setup instructions exactly and run npm start, there is this part that looks like two python clients are running:

[Tue Mar 27 2018 20:41:04 GMT+0000 (UTC)] INFO Starting socketIO client for js at 6466
[Tue Mar 27 2018 20:41:04 GMT+0000 (UTC)] INFO Starting socketIO client for python at 6466
[Tue Mar 27 2018 20:41:04 GMT+0000 (UTC)] INFO Starting socketIO client for python at 6466
...
File "/Users/ryanblakeley/Code/aiva/node_modules/spacy-nlp/src/client.py", line 12, in <module>
    import websocket
ImportError: No module named websocket

When I flip the python client to false in default.json that same log section looks like:

[Tue Mar 27 2018 20:55:49 GMT+0000 (UTC)] INFO Starting socketIO client for js at 6466
[Tue Mar 27 2018 20:55:49 GMT+0000 (UTC)] INFO Starting socketIO client for python at 6466
[Tue Mar 27 2018 20:55:49 GMT+0000 (UTC)] INFO Deploying bot aivadev with adapter SLACK
[Tue Mar 27 2018 20:55:49 GMT+0000 (UTC)] INFO js fAtBTrvCivRxSSSCAAAA joined, 2 remains
[Tue Mar 27 2018 20:55:49 GMT+0000 (UTC)] ERROR Traceback (most recent call last):
  File "/Users/ryanblakeley/Code/aiva/node_modules/spacy-nlp/src/client.py", line 12, in <module>
    import websocket

[Tue Mar 27 2018 20:55:49 GMT+0000 (UTC)] ERROR ImportError: No module named websocket

So the duplicate python client line is gone but the dependency error is still present.

As mentioned in #45, python3 -m pip show websocket looks like a positive result:

Name: websocket
Version: 0.2.1
Summary: Websocket implementation for gevent
Home-page: http://pypi.python.org/pypi/websocket
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: /usr/local/lib/python3.6/site-packages
Requires: greenlet, gevent
Read more comments on GitHub >

github_iconTop Results From Across the Web

warnings — Warning control — Python 3.11.1 documentation
Python programmers issue warnings by calling the warn() function defined in this module. (C programmers use PyErr_WarnEx() ; see Exception Handling for details ......
Read more >
Avoid 'Reloaded modules: <module_name>' message in Python
Go to Tools -> Preferences -> Python Interpreter and you will find User Module Reloader. Just deselect the checkbox with text as Show ......
Read more >
How to Fix PyCharm Import Error and Setup Your Interpreter
This will show you how to fix common pycharm import errors when trying to import python modules. Please watch through the entire video...
Read more >
'module' is not Accessed Pylance(Pylance is greyed out) #757
This isn't a bug. The warning is telling you that the source code for this module can't be resolved within your configured Python...
Read more >
Python import: Advanced Techniques and Tips
Handle resources and data files inside your packages; Import modules dynamically at runtime; Customize Python's import system. Throughout the tutorial, you'll ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found