Closed TechOpp closed 4 years ago
Thank you for the issue report. In the environment you're trying to use, could you please run and attach the output of: pip list
Secondly, how did you (directly, or indirectly) attempt to install py-ubjson?
I just tried the following under Windows 10, and it works fine for me:
python -mvenv myenv
myenv\Scripts\activate
pip install py-ubjson
python -c "import ubjson; print(ubjson.__version__)"
Since you're talking about crossbar - it sounds to me like some other problem, but given the lack of information it's difficult to tell.
Sorry for late reply!!! NOTE: I do all the set-up manually and avoid using Microsoft Package Installer(.msi) because this give me more clarity on both the environment windows as well as Linux. If you want to try this set-up do following steps 1.Just Download binary package(zip file) of Python not executable Installer and extract the package where you want to put it on your Hard Disk.
So i try with above setup and get the problem and resolve as mention in the issue. I also try with package installer(.msi) as your recommendation and you are right, there is no issue, so if you want to test my issue following is my steps from issue arise to resolve it. Thank you.
As i told, try to install Crossbar and the problem arise, Prompting me as a message:'ModuleNotFoundError: No module named ubjson'
So i try to install 'ubjson' manually by downloading zip file, extract the zip and go inside the folder where is 'setup.py' script file present. in my case: 'D:\WEB_SERVERS\PyTHON\WORKSPACE\AuthobahnPyClient\py-ubjson-0.16.1.tar\dist\py-ubjson-0.16.1\py-ubjson-0.16.1'
Now i try to install it manually as: 'python setup.py install' and this give me error as:
Traceback (most recent call last):
File "setup.py", line 36, in
So for this problem I just make a little modification in 'setup.py' script file at line no 36: 'From from ubjson import version as version' to 'from json import version as version' and now i run: 'python setup.py install' Now this install the 'py-ubjson' package.
$pip list before installation Package Version pip 20.2.2 setuptools 49.6.0 wheel 0.35.1
After Installation Package Version pip 20.2.2 py-ubjson 2.0.9 setuptools 49.6.0 wheel 0.35.1
So i try to install 'ubjson' manually by downloading zip file, extract the zip and go inside the folder where is 'setup.py' script file present.
The problem here is that normally, during a Python package installation, the setup.py
can import the modules being installed (in this case ubjson
). Due to how you've (manually) set up your PATH/PYTHONPATH/etc, it evidently is not in the PYTHONPATH.
It doesn't make sense to modify it to import from the json package. Why? Because it is a completely unrelated package which is part of the Python standard library. So the version defined by json.__version__
has nothing to do with ubjson.__version__
.
This is visible in your pip list
output - 2.0.9
is not the current py-ubjson release (0.16.1
).
Note that importing the package to get its version during install is common practice: See point 6 in this guide. In other words: It can't be right that all packages that have adopted this approach must be changed.
Definitely this is not the issue with ubjson package because when i go with installer package(.msi) setup of python then no issue occur in ubjson installation. So i can this is the problem with my setup of pythen environment. I will experiment with this, so now i want to close the issue.
But this is also true, with the same setup other packages installed successful, but why ubjosn not? Like pygame successfully install and work. D:>pip list Package Version
pip 20.2.2 pygame 1.9.6 setuptools 49.6.0 wheel 0.35.1
Like pygame successfully install and work.
That's because in that project they hard-code the version inside setup.py
itself.
Not only pygame many package installed in my setup with pip install, but ubjson not. If hard-code work then why not ubjson do the same.
If hard-code work then why not ubjson do the same.
Because this enables for the version to interrogated during runtime with from ubjson import __version__
. In the end maybe it's not that useful - but that's how it started.
I'm sorry you've had frustrating problems with getting this to work. But right now I don't have the time to change it.
Error: from ubjson import
__version__
as versionModuleNotFoundError: No module named 'ubjson'
I am installing crossbar its fail due to this error, experimenting whole a day with this minor issue. i just change ubjson to json in setup.py at line 37, then install correctly. So resolve this issue in global repository that by
pip
work for rest of the world.