mar10 / wsgidav

A generic and extendable WebDAV server based on WSGI
https://wsgidav.readthedocs.io
MIT License
979 stars 149 forks source link

ImportError: No module named wsgidav.server.server_cli #119

Closed kocane closed 6 years ago

kocane commented 6 years ago

Hello

I'm using, or trying to, wsgidav with seafile. The webdav part of seafile fails to start (there's an entire thread about it here but it seems like no one could find a solution), so I'm hoping I could find something here.

I've tried to make a service like another user did to solve his issue which is where I saw that it apparently fails at starting wsgidav.

I run command: /usr/bin/python2.7 -m wsgidav.server.run_server runfcgi --log-file /opt/apps/drive/logs/seafdav.log --pid /opt/apps/drive/pids/seafdav.pid --port 8282 --host localhost which then fails with /usr/bin/python2.7: No module named wsgidav.server

I've tried pip install wsgidav, reinstalling, uninstalling and installing along with pip install git+https://github.com/mar10/wsgidav.git seemingly to no avail and when running wsgidav it just complained the command couldn't be found. I then ran easy_install wsgidav and it allowed me to use the command wsgidav but when, for example, running wsgidav -v it fails with ImportError: No module named wsgidav.server.server_cli

mar10 commented 6 years ago

In a fresh Python 2 virtual environment, this works for me:

(issue119-eQB7iZw3) bash-3.2$ pip install wsgidav
Collecting wsgidav
  Using cached https://files.pythonhosted.org/packages/95/e8/88e25c17ff671f7fad21fe16cdc435c33c4befe35203bd47c05366af362a/WsgiDAV-2.4.1-py2.py3-none-any.whl
Collecting jsmin (from wsgidav)
Collecting defusedxml (from wsgidav)
  Using cached https://files.pythonhosted.org/packages/87/1c/17f3e3935a913dfe2a5ca85fa5ccbef366bfd82eb318b1f75dadbf0affca/defusedxml-0.5.0-py2.py3-none-any.whl
Collecting PyYAML (from wsgidav)
Installing collected packages: jsmin, defusedxml, PyYAML, wsgidav
Successfully installed PyYAML-3.13 defusedxml-0.5.0 jsmin-2.2.2 wsgidav-2.4.1
(issue119-eQB7iZw3) bash-3.2$ wsgidav -Vv
WsgiDAV/2.4.1 Python/2.7.10 Darwin-17.6.0-x86_64-i386-64bit

or

(issue119-eQB7iZw3) bash-3.2$ python -m wsgidav.server.server_cli -vV
WsgiDAV/2.4.1 Python/2.7.10 Darwin-17.6.0-x86_64-i386-64bit

wsgidav comes with a CLI that supports running WsgiDAV behind some WSGI compliant servers (cheroot is recommended), but you have to install them separately:

(issue119-eQB7iZw3) bash-3.2$ pip install cheroot
Collecting cheroot
  Using cached https://files.pythonhosted.org/packages/b4/eb/ca1311e138149c50a031accdb727e6849f201706481f63ce3ffc56be9e41/cheroot-6.3.3-py2.py3-none-any.whl
...
Installing collected packages: six, more-itertools, backports.functools-lru-cache, cheroot
Successfully installed backports.functools-lru-cache-1.5 cheroot-6.3.3 more-itertools-4.2.0 six-1.11.0

After that you can run the server:

(issue119-eQB7iZw3) bash-3.2$ wsgidav --server cheroot --root . --port 8080
Running without configuration file.
21:17:20.471 - <140735988159360> wsgidav.wsgidav_app  INFO   :  Default encoding: ascii (file system: utf-8)
...
21:17:20.472 - <140735988159360> wsgidav.wsgidav_app  INFO   :  Registered DAV providers:
21:17:20.473 - <140735988159360> wsgidav.wsgidav_app  INFO   :    Share '/': FilesystemProvider for path '/Users/martin/prj/issue119' (Read-Write) (anonymous)
21:17:20.473 - <140735988159360> wsgidav.wsgidav_app  WARNING:  WARNING: share '/' will allow anonymous access.
21:17:20.473 - <140735988159360> wsgidav              WARNING:  WARNING: Could not import lxml: using xml instead (slower). Consider installing lxml https://pypi.python.org/pypi/lxml.
21:17:20.569 - <140735988159360> wsgidav              INFO   :  Running WsgiDAV/2.4.1 Cheroot/6.3.3 Python/2.7.10
21:17:20.569 - <140735988159360> wsgidav              INFO   :  Serving on http://localhost:8080 ...

If you want to run WsgiDAV behind some other WSGI server, you may have to write some glue script. See here for an example: https://wsgidav.readthedocs.io/en/latest/user_guide_lib.html#run-inside-a-wsgi-server

I don't know seafile. Why do you need it to run the WebDAV server?

kocane commented 6 years ago

@mar10 thanks for the reply, it's all running off the same server.

I've made sure cheroot is installed as well.. I'm not sure what I can try to get a more clean virtual environment but I tried reinstalling virtualenv and virtualenvwrapper but nothing helps (I don't know much about python and all this).

This is what I get when I try your command:

root@naser:~# wsgidav --server cheroot --root . --port 8282
Traceback (most recent call last):
  File "/usr/local/bin/wsgidav", line 11, in <module>
    load_entry_point('WsgiDAV==3.0.0a3', 'console_scripts', 'wsgidav')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named wsgidav.server.server_cli

Any other suggestions? :-/

I like to have the ability to use webdav on my seafile together with various apps. For instance I depend a lot on FolderSync on my Android phone which uses WebDAV to communicate with my Seafile :-)

Thanks,

mar10 commented 6 years ago

what does pip list give you?

kocane commented 6 years ago

@mar10

appdirs (1.4.3)
apprise (0.0.9)
APScheduler (3.5.1)
attrs (16.3.0)
babelfish (0.5.5)
backports.functools-lru-cache (1.5)
backports.ssl-match-hostname (3.5.0.1)
beautifulsoup4 (4.6.0)
bottle (0.12.13)
bottle-fdsend (0.1.1)
cached-property (1.3.0)
certbot (0.26.0.dev0)
certbot-dns-digitalocean (0.26.0.dev0)
certifi (2018.4.16)
chardet (3.0.4)
Cheetah (2.4.4)
cheroot (6.3.3)
CherryPy (2.3.0)
cliapp (1.20160724)
click (6.7)
cmdtest (0.27)
colorama (0.3.7)
ConfigArgParse (0.13.0)
configobj (5.0.6)
constantly (15.1.0)
cryptography (1.7.1)
decorator (4.3.0)
defusedxml (0.5.0)
deluge (1.3.13)
dnspython (1.15.0)
docker-compose (1.8.0)
docker-py (1.9.0)
dockerpty (0.4.1)
docopt (0.6.2)
dogpile.cache (0.6.5)
enum34 (1.1.6)
funcsigs (1.0.2)
functools32 (3.2.3.post2)
future (0.16.0)
futures (3.2.0)
gitdb2 (2.0.3)
GitPython (2.1.10)
guessit (3.0.0)
idna (2.7)
imageio (2.3.0)
incremental (16.10.1)
ipaddr (2.2.0)
ipaddress (1.0.17)
Jinja2 (2.10)
josepy (1.1.0)
jsmin (2.2.2)
jsonpickle (0.9.6)
jsonschema (2.5.1)
keyring (10.1)
keyrings.alt (1.3)
langdetect (1.0.7)
libvirt-python (4.0.0)
Mako (1.0.6)
Markdown (2.6.8)
MarkupSafe (0.23)
mercurial (4.0)
mock (2.0.0)
more-itertools (4.2.0)
moviepy (0.2.3.5)
mysqlclient (1.3.7)
numpy (1.14.5)
oauthlib (2.1.0)
PAM (0.4.2)
parsedatetime (2.4)
pbr (4.0.4)
Pillow (5.1.0)
pip (9.0.1)
pipenv (2018.7.1)
py-pretty (1)
pyasn1 (0.1.9)
pyasn1-modules (0.0.7)
pycountry (18.5.26)
pycrypto (2.6.1)
Pygments (2.2.0)
pygobject (3.22.0)
PyICU (1.9.5)
pylibpcap (0.6.4)
pyOpenSSL (16.2.0)
pyRFC3339 (1.1)
pyserial (3.2.1)
pysqlite (1.0.1)
pysrt (1.1.1)
python-dateutil (2.7.3)
python-digitalocean (1.13.2)
python-ldap (2.4.28)
python-libtorrent (1.1.1)
python-memcached (1.53)
pytz (2018.4)
pyudev (0.21.0)
pyunifi (2.13)
pyxdg (0.25)
PyYAML (3.13)
rarfile (3.0)
rebulk (0.9.0)
requests (2.19.1)
requests-cache (0.4.13)
requests-oauthlib (1.0.0)
requests-toolbelt (0.8.0)
sabyenc (3.3.5)
SecretStorage (2.3.1)
series-renamer (1.1.2)
service-identity (16.0.0)
setuptools (40.0.0)
six (1.11.0)
smmap2 (2.0.3)
speedtest-cli (2.0.2)
stevedore (1.28.0)
texttable (0.8.4)
tqdm (4.23.4)
ttystatus (0.34)
tvdb-api (2.0)
Twisted (16.6.0)
tzlocal (1.5.1)
urllib3 (1.23)
virtualenv (16.0.0)
virtualenv-clone (0.3.0)
virtualenvwrapper (4.8.2)
waitress (1.1.0)
websocket-client (0.37.0)
wheel (0.29.0)
WsgiDAV (3.0.0a3)
WSGIserver (1.3)
yenc (0.4.0)
zope.component (4.4.1)
zope.event (4.3.0)
zope.interface (4.3.2)
mar10 commented 6 years ago

This looks like quite a lot. Are you sure you activated the virtual environment? (I often use pipenv shell Instead of virtualenv, because it is a bit easier to use.)

kocane commented 6 years ago

@mar10 Hmm... when I run it in pipenv shell, it works fine... but how did another user make a service that worked with the command /usr/bin/python2.7 -m wsgidav.server.run_server runfcgi --log-file /opt/apps/drive/logs/seafdav.log --pid /opt/apps/drive/pids/seafdav.pid --port 8081 --host localhost?

The "issue" might be closeable since it's likely myself doing something wrong but I'd still love getting webDAV in seafile to work :\

mar10 commented 6 years ago

/usr/bin/python2.7 ... does not use a virtual env, but the system python installation, which is not recommended. pipenv uses virtualenv internally AFAIK, so it should not make a difference. I assume you did not activate the virtualenv before.

Anyways: The seafile guys vendored WsgiDAV and modified run_server in some way, so you should ask there.

AdMediastic commented 1 year ago

Hey @kocane

The reason why this is happening is because you have used sudo

Make sure you run all pip install commands in sudo

Hopefully the problem should resolve!