fabio
fabio

Reputation: 1365

Copy a django project in another PC (postgreSQL)

I have a project in my notebook and I want copy it in my desktop. I use windows 7 in both

I installed python 3.5 (a different version, to be honest, in my notebook was 3.4) and postgreSQL. Of course the directory structure is different. In my notebook is:

C:/Python34/scripts/myproject1

C:/Python34/scripts/myproject1/myvenv

While in my desktop:

D:/Python/progetti/myproject1

D:/Python/progetti/myproject1/myvenv

So I copied C:/.../myproject1 in D:/Python/progetti/, deleted myvenv directory, created a new virtualenv (same name) and tried to install the requirements from requirements.txt but it give an error:

Installing collected packages: Django, django-crispy-forms,
django-registration-redux, docutils, Pillow, psycopg2, virtualenv, virtualenv
wrapper-win
  Running setup.py install for django-crispy-forms ... done
  Running setup.py install for django-registration-redux ... done
  Running setup.py install for psycopg2 ... error
    Complete output from command d:\python\progetti\possedimenti\myvenv\scripts\
python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\fabio\\AppDat
a\\Local\\Temp\\pip-build-xdv57y50\\psycopg2\\setup.py';exec(compile(getattr(tok
enize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
 install --record C:\Users\fabio\AppData\Local\Temp\pip-x4__ikww-record\install-
record.txt --single-version-externally-managed --compile --install-headers d:\py
thon\progetti\possedimenti\myvenv\include\site\python3.5\psycopg2:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.5
    creating build\lib.win32-3.5\psycopg2
    copying lib\errorcodes.py -> build\lib.win32-3.5\psycopg2
    copying lib\extensions.py -> build\lib.win32-3.5\psycopg2
    copying lib\extras.py -> build\lib.win32-3.5\psycopg2
    copying lib\pool.py -> build\lib.win32-3.5\psycopg2
    copying lib\psycopg1.py -> build\lib.win32-3.5\psycopg2
    copying lib\tz.py -> build\lib.win32-3.5\psycopg2
    copying lib\_json.py -> build\lib.win32-3.5\psycopg2
    copying lib\_range.py -> build\lib.win32-3.5\psycopg2
    copying lib\__init__.py -> build\lib.win32-3.5\psycopg2
    creating build\lib.win32-3.5\psycopg2\tests
    copying tests\dbapi20.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\dbapi20_tpc.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\testconfig.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\testutils.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_async.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_bugX000.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_bug_gc.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_cancel.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_connection.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_copy.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_cursor.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_dates.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_extras_dictcursor.py -> build\lib.win32-3.5\psycopg2\test
s
    copying tests\test_green.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_lobject.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_module.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_notify.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_psycopg2_dbapi20.py -> build\lib.win32-3.5\psycopg2\tests

    copying tests\test_quote.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_transaction.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_types_basic.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_types_extras.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\test_with.py -> build\lib.win32-3.5\psycopg2\tests
    copying tests\__init__.py -> build\lib.win32-3.5\psycopg2\tests
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    building 'psycopg2._psycopg' extension
    error: Unable to find vcvarsall.bat

    ----------------------------------------
Command "d:\python\progetti\possedimenti\myvenv\scripts\python.exe -u -c "import
 setuptools, tokenize;__file__='C:\\Users\\fabio\\AppData\\Local\\Temp\\pip-buil
d-xdv57y50\\psycopg2\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__f
ile__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Use
rs\fabio\AppData\Local\Temp\pip-x4__ikww-record\install-record.txt --single-vers
ion-externally-managed --compile --install-headers d:\python\progetti\possedimen
ti\myvenv\include\site\python3.5\psycopg2" failed with error code 1 in C:\Users\
fabio\AppData\Local\Temp\pip-build-xdv57y50\psycopg2\

It looks there's some problem with postgreSQL, I think. Note that the database don't exist yet.

Thank you for your help

Upvotes: 0

Views: 294

Answers (2)

fabio
fabio

Reputation: 1365

I think Python 3.5 require MS Visual C++ 2015 (look here) so I installed it. I'm not sure that is a good thing because it installed something like 17 (!) more MS .NET Framework 16 (!) MS SQL Server, 4 or 5 more MS Visual C++, Ms web deploy, and 2-3 other things in my Control Panel => Programs and Feature. It's about 2GB of stuff and it took more than 2 hours to install/download all... It is normal?

Then I noticed that in my requirements.txt there was psycopg2==2.6.1 while psycopg2 2.6.2 (the actual version) supports python 3.5 and postgreSQL 9.5 so I upgrade that instead to downgrade the others...

It works, but maybe can I uninstall MS visual 2015?

Upvotes: 0

miyamoto
miyamoto

Reputation: 1540

Python 3.5 is not currently supported by the python Postgres driver psycopg2:

The current psycopg2 implementation supports:

  • Python 2 versions from 2.5 to 2.7
  • Python 3 versions from 3.1 to 3.4
  • PostgreSQL versions from 7.4 to 9.4

An easy workaround is to create a Python 3.4 virtual environment and run your project there.

Upvotes: 1

Related Questions