import nanomsg ERROR
C:\Python27\Lib\site-packages\nanomsg-1.0a2-py2.7-win-amd64.egg\nanomsg_wrappers__init__.py:22: UserWarning: Could not
load the default wrapper for your platform: cpy, performance may be affected!
"%s, performance may be affected!") % (default,))
Traceback (most recent call last):
File "F:\eclipse_projects\test\nanomsq_t1.py", line 3, in
Hi, If you add the nanomsg.dll to your PATH this should work, but it will be using the ctypes backend which is a bit slower.
I'm afraid building the library from source on windows is a bit hard. I will upload binaries for windows to PyPI as soon as I can.
Hi, add the nanomsg.dll to PATH can't solve the problem ;( still the same error
Hi, any progress on windows support? Building nanomsg sources was easy part but I cannot make nanomsg-python work.
I have manage to make it work on windows. Maybe my tips would be usefull for someone.
Requirements: visual studio, cmake
- download nanomsg c sources.
- build nanomsg c sources (as described on nanomsg website (http://nanomsg.org/development.html). i.e.:
- make build directory in nanomsg sources dir
- run cmake .. from build dir
- build nanomsg sources, in my case I'v made it from command line:
- First I had to run vcvarsall.bat (which resides somewhere in visual studio directory)
- and I build library by runing: msbuild nanomsg.sln /t:Build /p:Configuration=Release
after this step you should find nanomsg.lib and nanomsg.dll in Release (or Debug) directory.
- copy nanomsg.lib to your
\libs directory after this step simillar patch should exists in your system: c:\python27\libs\nanomsg.lib - make nanomsg directory in your
\include directory. - copy nanomsg c sources to your
\include\nanomsg after this step simillar patch should exists in your system: c:\python27\include\nanomsg\nn.h - finally try to install python nanomsg: python setup.py install
now you can start to use nanomsg in python - BUT YOU NEED: nanomsg.dll in directory from which you run script.
If there is no nanomsg.dll you will get exception after import nanomsg (WindowsError: [Error 126] ....).
If it's working you can delete
It would be nice to make it easier - maybe someone knows easy way to make binary package installer with nanomsg.dll included.
If you like to I can send you binary installer of python module "nanomsg-1.0.win32-py2.7.exe" (made with python setup.py bdist --format=wininst) and a nanomsg.dll.
@vac thanks pal. it solved my problem.
You can create a complete windows installer (that contains the compiled dll) by adding the following line to setup.py
setup( name='nanomsg', version=version, packages=[str('nanomsg'), str('_nanomsg_ctypes'), str('nanomsg_wrappers')], data_files=[('lib\site-packages',["C:\Dev\external\nanomsg\x64\Release\nanomsg.dll"])], ...
of course change the path to nanomsg.dll
yeah windows installer is nice but unfortunately python lib/site-packages are not in windows PATH by default.. So your app/script which is using nanomsg still cannot find dll...
Ok it's now much better. I'v made windows installer with dll included as @shluvme suggested: setup.py:
data_files=[('lib/site-packages',["../nanomsg/nanomsg.dll",])]
setup(
name='nanomsg',
version=__version__,
packages=[str('nanomsg'), str('_nanomsg_ctypes'), str('nanomsg_wrappers')],
data_files = data_files,
dll would be copied to python site-pakcages. To make sure that it's directory would be included in system PATH I'v added following code to nanomsg/init.py:
from __future__ import division, absolute_import, print_function, unicode_literals
from .version import __version__
from struct import Struct as _Struct
import warnings
#-----HERE:-------
import distutils.sysconfig
import os
os.environ['PATH'] += ';'+distutils.sysconfig.get_python_lib()
#-----------------
from . import wrapper
This way everytime nanomsg is imported the site-packages are added to system path and nanomsg.dll can be found by wrapper.
Installer is made with python setup.py bdist_wininst.
ps. if you would like to test my windows build I'v put installer here: http://vacu.la/python/nanomsg-1.0.win32-py2.7.exe
warning: nanomsg and nanomsg-python code which was used to generate dll and installer is not recent (april 2015)