Windows Swarming MySQL Error

Hello, I am having a problem with nupic swarming on Windows 7. I installed nupic for Windows following the directions in this thread.

Running the /examples/opf/clients/hotgym/simple/hotgym.py executes correctly. However, when I try to run examples/opf/clients/hotgym/prediction/one_gym/swarm.py I get the error listed below.

$ python swarm.py
WARNING:nupic.database.client_jobs_dao:[] First failure in <function connect at 0x0000000003CB9A58>; initial retry in 0.1 sec.; timeoutSec=300. Caller stack:
File “swarm.py”, line 114, in
swarm(INPUT_FILE)
File “swarm.py”, line 106, in swarm
modelParams = swarmForBestModelParams(SWARM_DESCRIPTION, name)
File “swarm.py”, line 83, in swarmForBestModelParams
verbosity=0
File “C:\Python27\lib\site-packages\nupic\swarming\permutations_runner.py”, line 271, in runWithConfig
return _runAction(runOptions)
File “C:\Python27\lib\site-packages\nupic\swarming\permutations_runner.py”, line 212, in _runAction
returnValue = _runHyperSearch(runOptions)
File “C:\Python27\lib\site-packages\nupic\swarming\permutations_runner.py”, line 141, in _runHyperSearch
search = _HyperSearchRunner(runOptions)
File “C:\Python27\lib\site-packages\nupic\swarming\permutations_runner.py”, line 412, in init
self.__cjDAO = _clientJobsDB()
File “C:\Python27\lib\site-packages\nupic\swarming\permutations_runner.py”, line 376, in _clientJobsDB
return cjdao.ClientJobsDAO.get()
File “C:\Python27\lib\site-packages\nupic\support\decorators.py”, line 56, in exceptionLoggingWrap
return func(*args, **kwargs)
File “C:\Python27\lib\site-packages\nupic\database\client_jobs_dao.py”, line 548, in get
cjDAO.connect()
File “C:\Python27\lib\site-packages\nupic\support\decorators.py”, line 56, in exceptionLoggingWrap
return func(*args, **kwargs)
File “C:\Python27\lib\site-packages\nupic\support\decorators.py”, line 234, in retryWrap
timeoutSec, ‘’.join(traceback.format_stack()), exc_info=True)
Traceback (most recent call last):
File “C:\Python27\lib\site-packages\nupic\support\decorators.py”, line 208, in retryWrap
result = func(*args, **kwargs)
File “C:\Python27\lib\site-packages\nupic\database\client_jobs_dao.py”, line 633, in connect
with ConnectionFactory.get() as conn:
File “C:\Python27\lib\site-packages\nupic\database\connection.py”, line 167, in get
return cls._connectionPolicy.acquireConnection()
File “C:\Python27\lib\site-packages\nupic\database\connection.py”, line 553, in acquireConnection
dbConn = self._pool.connection(shareable=False)
File “C:\Python27\lib\site-packages\DBUtils\PooledDB.py”, line 331, in connection
con = self.steady_connection()
File “C:\Python27\lib\site-packages\DBUtils\PooledDB.py”, line 279, in steady_connection
*self._args, **self._kwargs)
File “C:\Python27\lib\site-packages\DBUtils\SteadyDB.py”, line 134, in connect
failures, ping, closeable, *args, **kwargs)
File “C:\Python27\lib\site-packages\DBUtils\SteadyDB.py”, line 186, in init
self._store(self._create())
File “C:\Python27\lib\site-packages\DBUtils\SteadyDB.py”, line 190, in _create
con = self._creator(*self._args, **self.kwargs)
File "C:\Python27\lib\site-packages\pymysql_init
.py", line 88, in Connect
return Connection(*args, **kwargs)
File “C:\Python27\lib\site-packages\pymysql\connections.py”, line 626, in init
self._connect()
File “C:\Python27\lib\site-packages\pymysql\connections.py”, line 818, in _connect
2003, “Can’t connect to MySQL server on %r (%s)” % (self.host, e))
OperationalError: (2003, “Can’t connect to MySQL server on ‘localhost’ (255)”)

I have MySQL Community Server 8.0.15 installed, and I changed the passwords in the nupic-site.xml and nupic-default.xml files to match. If it helps, the MySQL client outputs the following status:

mysql> status
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe Ver 8.0.15 for Win64 on x
86_64 (MySQL Community Server - GPL)

Connection id: 150
Current database:
Current user: root@localhost
SSL: Cipher in use is DHE-RSA-AES128-GCM-SHA256
Using delimiter: ;
Server version: 8.0.15 MySQL Community Server - GPL
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: cp850
Conn. characterset: cp850
TCP port: 3306
Uptime: 2 hours 27 min 6 sec

Threads: 2 Questions: 37 Slow queries: 0 Opens: 110 Flush tables: 2 Open ta
bles: 86 Queries per second avg: 0.004

Any thoughts or help would be much appreciated!

One of your messages says Can’t connect to MySQL server on ‘localhost’ (255), and another says TCP port: 3306. Are you sure you are running MySQL on the port you are expecting?

Also, why are you running a swarm? Maybe you don’t need to.

Thanks for the quick response! This is my first time working with MySQL, so I will have to confess some ignorance in that area. But I believe I have it configured correctly. Below is the relevant section of the nupic-default.xml (nupic-site.xml is identical). So it looks like they match up. As for whether MySQL is “running”, I am assuming that that is confirmed by the status command return.

I don’t know if I will need to run a swarm for my actual project. This is just me trying to replicate the examples.

<property>
<name>nupic.cluster.database.host</name>
<value>localhost</value>
<description>Name of the machine running the MySQL database 
   server</description>
</property>

<property>
  <name>nupic.cluster.database.user</name>
  <value>root</value>
  <description>Username for the MySQL database server </description>
</property>

<property>
  <name>nupic.cluster.database.port</name>
  <value>3306</value>
  <description>Port number for the MySQL database server </description>
</property>

<property>
  <name>nupic.cluster.database.passwd</name>
  <value>{my password}</value>
  <description>Password for the MySQL database server </description>
</property>

Ok, the only thing you would need MySQL for is swarming. Do you have a project in mind or are you just getting things running? If no project, I suggest you skip the swarming and use an anomaly detection example that has pre-canned model parameters.

OK, I will skip to other examples that do not use swarming. I do have a project, but I am still investigating/deciding how to best implement it using nupic. If it turns out I need swarming, I will revisit the issue. And if I find a solution to the MySQL errir, I will post back here. Thanks again!

1 Like

Try this one I think it still works.

Maybe it’s a little late, but I got the problem solved.
After a few hours of debugging, it turns out that pymysql expects something else from mysql server which pointed me to the compatibility issue. I downgraded mysql to 5.6 (Docker image) and it works.
Hope this helps!

3 Likes