UltrosBot / Ultros

Connecting communities, one squid at a time! Ultros is a multi-protocol chat bot written in Python, designed with both the user and developer in mind
http://ultros.io
Artistic License 2.0
23 stars 7 forks source link

Library download code errors #95

Closed denali1 closed 7 years ago

denali1 commented 7 years ago

Ultros throws the following error on run. It appears the two libraries have moved. Maybe consider using PIP to install them?

[denali@hera Ultros-master]$ python run.py
>> Checking for libraries to download..
>> Downloading library: SocksiPy
 > Attribution: [New BSD license] Dan Haim and the branch maintainers
[ERROR] HTTP Error 404: Not Found
[ERROR] Please report this to the developers. Attempted URL: http://socksipy-branch.googlecode.com/svn/branches/1.00/socks.py

>> Downloading library: SocksiPyHandler
 > Attribution: [Gist, no license header] e000 <e@tr0ll.in>
[ERROR] Unable to import module: No module named socks
[ERROR] Please report this to the developers.

>> Downloading library: NewBase60
 > Attribution: [CC0 Public Domain] Kevin Marks <kevinmarks@gmail.com>

>> Done - 2 failed / 1 succeeded

Traceback (most recent call last):
  File "run.py", line 38, in <module>
    from system.core import Ultros
  File "/home/denali/Ultros-master/system/core.py", line 2, in <module>
    from system.factory_manager import FactoryManager
  File "/home/denali/Ultros-master/system/factory_manager.py", line 8, in <module>
    from system.commands.manager import CommandManager
  File "/home/denali/Ultros-master/system/commands/manager.py", line 6, in <module>
    from system.decorators.log import deprecated
  File "/home/denali/Ultros-master/system/decorators/__init__.py", line 15, in <module>
    from .filter import accepts
  File "/home/denali/Ultros-master/system/decorators/filter.py", line 8, in <module>
    _ = Translations().get()
  File "/home/denali/Ultros-master/system/singleton.py", line 31, in __call__
    **kwargs)
  File "/home/denali/Ultros-master/system/translations.py", line 27, in __init__
    self.set_language(lang, mlang)
  File "/home/denali/Ultros-master/system/translations.py", line 39, in set_language
    from system.logging.logger import getLogger
  File "/home/denali/Ultros-master/system/logging/logger.py", line 22, in <module>
    import system.logging.shim as shim
  File "/home/denali/Ultros-master/system/logging/shim.py", line 20, in <module>
    import logbook.base
ImportError: No module named logbook.base
gdude2002 commented 7 years ago

The actual traceback has nothing to do with the library downloads - logbook should indeed by installed by pip.

gdude2002 commented 7 years ago

According to the documentation, logbook.base has not been removed - please insure you've installed the requirements.txt correctly.

gdude2002 commented 7 years ago

As for the libraries, we're aware that they've moved. We don't actually use them, so I'll put a patch in to remove them, but please note that we're currently rewriting Ultros for Python 3 (from scratch) and will only be providing bugfixes here.

EDIT: https://github.com/UltrosBot/Ultros/commit/c11db3b254af4373aec27ac9e2e68137ffae76be

At the time of writing this system, these libraries weren't available on PyPi, by the way.

denali1 commented 7 years ago

Understood. Unfortunately, I can't move to Python 3, as one of my utilities that I use regularly still requires 2.7. Thanks for your help!

gdude2002 commented 7 years ago

Virtualenv is your solution there - it's very easy to have multiple versions of Python on one system.

Unfortunately this is just the way of things, as we move to Python 3, there's going to be a few growing pains. My machine has Python 2 installed by default, but I have Python 3 installed as python3.5 and use virtualenv to get around the small details.

Has your issue been fixed?

denali1 commented 7 years ago

Yes and no. A new TB has been thrown regarding TLS. This is after installing everything in requirements.txt and requirements-test.txt.

Traceback (most recent call last):
  File "run.py", line 38, in <module>
    from system.core import Ultros
  File "/home/denali/Ultros-master/system/core.py", line 2, in <module>
    from system.factory_manager import FactoryManager
  File "/home/denali/Ultros-master/system/factory_manager.py", line 5, in <module>
    from twisted.internet import reactor
  File "/usr/lib64/python2.7/site-packages/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default
  File "/usr/lib64/python2.7/site-packages/twisted/internet/default.py", line 56, in <module>
    install = _getInstallFunction(platform)
  File "/usr/lib64/python2.7/site-packages/twisted/internet/default.py", line 44, in _getInstallFunction
    from twisted.internet.epollreactor import install
  File "/usr/lib64/python2.7/site-packages/twisted/internet/epollreactor.py", line 24, in <module>
    from twisted.internet import posixbase
  File "/usr/lib64/python2.7/site-packages/twisted/internet/posixbase.py", line 18, in <module>
    from twisted.internet import error, udp, tcp
  File "/usr/lib64/python2.7/site-packages/twisted/internet/tcp.py", line 28, in <module>
    from twisted.internet._newtls import (
  File "/usr/lib64/python2.7/site-packages/twisted/internet/_newtls.py", line 21, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/usr/lib64/python2.7/site-packages/twisted/protocols/tls.py", line 63, in <module>
    from twisted.internet._sslverify import _setAcceptableProtocols
  File "/usr/lib64/python2.7/site-packages/twisted/internet/_sslverify.py", line 38, in <module>
    TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
gdude2002 commented 7 years ago

Huh, okay, that's interesting.

This looks like a problem with Twisted - it's not the first time I've seen a problem like this either. Naturally Ultros was built against an older twisted - that said, some people aren't having this problem even on latest Twisted.

Frankly, this error stumps me. However, this might be related to the support of the SSL libraries installed on your system - Check that out perhaps, and try installing Twisted yourself from source.

denali1 commented 7 years ago

Well, I tried:

pip install --upgrade pyopenssl
pip install -U Twisted[tls]

I'll keep working on it.

EDITED to add: Maybe I should complete my thought... Neither command resolved the TB.

gdude2002 commented 7 years ago

Alrighty

Sorry, I don't really have much other info for you, other than that there's a reason we dropped Twisted.

If it helps, this is what my instance is currently running.

denali1 commented 7 years ago

Yup, same version I'm using. I found a reference that says python-openssl (which twisted uses) breaks pyOpenSSL. I'm guessing that may be the problem.

gdude2002 commented 7 years ago

Wouldn't explain why it works for some users, though. There has to be more to it than that.

gdude2002 commented 7 years ago

Are you running in a virtualenv?

denali1 commented 7 years ago

No.

gdude2002 commented 7 years ago

You might consider trying that - ensure no external packages are complicating things.

pip install virtualenv
python -m virtualenv env
. env/bin/activate
pip install -r requirements.txt
python run.py
denali1 commented 7 years ago
Traceback (most recent call last):
  File "run.py", line 35, in <module>
    from kitchen.text.converters import getwriter
ImportError: No module named kitchen.text.converters

I verified that kitchen is installed.

gdude2002 commented 7 years ago

You did reinstall the reqs after activating the env, right?

By the way, you said you were running Twisted 17.x, but requirements.txt pins it to 15.x (yet another reason to use an env).

If you're doing everything right, though, I'm going to have to say that you've got a problem with your environment.

denali1 commented 7 years ago

I may end up putting up a VM and running it then. The server has the processor power and memory for it. At least that way I can get a pristine environment for it to run in.

gdude2002 commented 7 years ago

Honestly, there's no real reason that virtualenv shouldn't work for you for that unless you have a broken Python setup.

Do whatever works for you though, of course.

denali1 commented 7 years ago

Fair enough. Thanks for all your help. BTW, you've been the fastest person to respond to issues. I'm truly impressed.

gdude2002 commented 7 years ago

Haha, email clients work wonders.

Let us know how you get on!

denali1 commented 7 years ago

Will do! Thanks again! Closing issue -- not a Ultros problem.