foxmask / dj-diabetes

:snake: :pill: My Glucose Manager - follow your daily health
BSD 3-Clause "New" or "Revised" License
92 stars 20 forks source link

Can not install dj-diabetes #12

Closed petrk94 closed 6 years ago

petrk94 commented 6 years ago

Hello, Im facing an issue on the shared host server, Im using

$ pip install -r requirements.txt
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting arrow==0.12.0 (from -r requirements.txt (line 1))
  Using cached arrow-0.12.0.tar.gz
Collecting Django==2.0 (from -r requirements.txt (line 2))
  Using cached Django-2.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-lDX5xx/Django/setup.py", line 32, in <module>
        version = __import__('django').get_version()
      File "django/__init__.py", line 1, in <module>
        from django.utils.version import get_version
      File "django/utils/version.py", line 61, in <module>
        @functools.lru_cache()
    AttributeError: 'module' object has no attribute 'lru_cache'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-lDX5xx/Django

This is the error message I get. I hope you can help me

foxmask commented 6 years ago

are you using python 3 ?

petrk94 commented 6 years ago

By default on the shared host server is Python -V 2.7 But there is even Python 3. The problem, Pip seems to choose the older Python version. And I don't know how to use pip with Python3

foxmask commented 6 years ago

Use pip3 instead ;)

petrk94 commented 6 years ago
I have tried, looked good a the beginning, but failed too:
$ pip3 install -r requirements.txt
Collecting arrow==0.12.0 (from -r requirements.txt (line 1))
  Using cached arrow-0.12.0.tar.gz
Collecting Django==2.0 (from -r requirements.txt (line 2))
  Downloading Django-2.0-py3-none-any.whl (7.1MB)
    100% |████████████████████████████████| 7.1MB 92kB/s
Collecting six==1.11.0 (from -r requirements.txt (line 3))
  Downloading six-1.11.0-py2.py3-none-any.whl
Collecting flake8==3.5.0 (from -r requirements.txt (line 4))
  Downloading flake8-3.5.0-py2.py3-none-any.whl (69kB)
    100% |████████████████████████████████| 71kB 4.7MB/s
Collecting python-dateutil (from arrow==0.12.0->-r requirements.txt (line 1))  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 1.2MB/s
Collecting pytz (from Django==2.0->-r requirements.txt (line 2))
  Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
    100% |████████████████████████████████| 512kB 1.1MB/s
Collecting mccabe<0.7.0,>=0.6.0 (from flake8==3.5.0->-r requirements.txt (line 4))
  Downloading mccabe-0.6.1-py2.py3-none-any.whl
Collecting pycodestyle<2.4.0,>=2.0.0 (from flake8==3.5.0->-r requirements.txt (line 4))
  Downloading pycodestyle-2.3.1-py2.py3-none-any.whl (45kB)
    100% |████████████████████████████████| 51kB 4.8MB/s
Collecting pyflakes<1.7.0,>=1.5.0 (from flake8==3.5.0->-r requirements.txt (line 4))
  Downloading pyflakes-1.6.0-py2.py3-none-any.whl (227kB)
    100% |████████████████████████████████| 235kB 2.8MB/s
Installing collected packages: six, python-dateutil, arrow, pytz, Django, mccabe, pycodestyle, pyflakes, flake8
Exception:
Traceback (most recent call last):
  File "/package/host/localhost/python-3.4.6/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/package/host/localhost/python-3.4.6/lib/python3.4/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/package/host/localhost/python-3.4.6/lib/python3.4/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/package/host/localhost/python-3.4.6/lib/python3.4/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/package/host/localhost/python-3.4.6/lib/python3.4/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/package/host/localhost/python-3.4.6/lib/python3.4/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/package/host/localhost/python-3.4.6/lib/python3.4/site-packages/pip/wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/package/host/localhost/python-3.4.6/lib/python3.4/shutil.py", line 109, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/package/host/localhost/python-3.4.6/lib/python3.4/site-packages/six.py'
foxmask commented 6 years ago

This error occurs because you are connected as an end-user and try to install files into directories where you dont have the rights.

So first of all start by creating a new virtualenv like this:

python -m venv <the name of virtualenv you want>

then go into that virtualenv

cd <the name of virtualenv you want>

activate the virtualenv by:

source bin/activate

then clone

git clone https://github.com/foxmask/dj-diabetes.git

then install

cd dj-diabetes
pip3 install -r requirements.txt
petrk94 commented 6 years ago

ok thanks, this worked now all and the migration was successful. But now I have it in /var/www/virtual/xxxx/diabetes/dj-diabetes/

How I can run it as subdomain and which commands are necessary to start the python server for this project?

tylergale commented 6 years ago

I'm assuming you would need some sort of HTTP proxy, such as Nginx? Check https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

petrk94 commented 6 years ago

@tylergale is it even possible without? This all seems to be very complicated, just to set this up and make it reachable, especially I can not just easily install a Nginx Server on my shared host account.

foxmask commented 6 years ago

@petrk94 you can install this project on your desktop for your own usage and thus no need to setup NGINX, just start

python manage.py runserver &

and access to the project by http://127.0.0.1:8000/

If you plan to host it on a (shared hosting) server provider without any knowledge, that will be very complicated.