SQLAlchemy: verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 63: Regel 63:
  
 
== Installatie SQLAlchemy (jan. 2019 - Python 3.x) ==
 
== Installatie SQLAlchemy (jan. 2019 - Python 3.x) ==
 +
 +
Dit lijkt niet te werken, want het installeert voor Python 2.7:
 +
 +
<pre>
 +
pip install sqlalchemy
 +
/home/strompf/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
 +
  warnings.warn(warning, RequestsDependencyWarning)
 +
Collecting sqlalchemy
 +
  Downloading https://files.pythonhosted.org/packages/05/d2/17fb194f4ae83577258ea1d81da3d5d5643f4957fa14fd0261d78d648bf5/SQLAlchemy-1.2.16.tar.gz (5.7MB)
 +
    100% |████████████████████████████████| 5.7MB 10.0MB/s
 +
Installing collected packages: sqlalchemy
 +
  Running setup.py install for sqlalchemy ... error
 +
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p1Hf3p/sqlalchemy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ciOy3f/install-record.txt --single-version-externally-managed --compile:
 +
    running install
 +
    running build
 +
    running build_py
 +
    creating build
 +
    creating build/lib.linux-x86_64-2.7
 +
    creating build/lib.linux-x86_64-2.7/sqlalchemy
 +
    copying lib/sqlalchemy/pool.py -> build/lib.linux-x86_64-2.7/sqlalchemy
 +
...
 +
    copying lib/sqlalchemy/dialects/mssql/information_schema.py -> build/lib.linux-x86_64-2.7/sqlalchemy/dialects/mssql
 +
    running build_ext
 +
    building 'sqlalchemy.cprocessors' extension
 +
    creating build/temp.linux-x86_64-2.7
 +
    creating build/temp.linux-x86_64-2.7/lib
 +
    creating build/temp.linux-x86_64-2.7/lib/sqlalchemy
 +
    creating build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension
 +
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/processors.c -o build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/processors.o
 +
    lib/sqlalchemy/cextension/processors.c:10:20: fatal error: Python.h: No such file or directory
 +
    compilation terminated.
 +
    ***************************************************************************
 +
    command 'x86_64-linux-gnu-gcc' failed with exit status 1
 +
    WARNING: The C extension could not be compiled, speedups are not enabled.
 +
    Failure information, if any, is above.
 +
    Retrying the build without the C extension now.
 +
    ***************************************************************************
 +
    running install
 +
    running build
 +
    running build_py
 +
    running build_ext
 +
    running install_lib
 +
    creating /usr/local/lib/python2.7/dist-packages/sqlalchemy
 +
    error: could not create '/usr/local/lib/python2.7/dist-packages/sqlalchemy': Permission denied
 +
   
 +
    ----------------------------------------
 +
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p1Hf3p/sqlalchemy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ciOy3f/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-p1Hf3p/sqlalchemy/
 +
</pre>

Versie van 14 jan 2019 15:01

Installatie (okt. 2018 - Python 2.7)

  • Download .tar.gz-bestand naar
  • Pak het bestand uit en plaats inhoud in een map onder /usr/local/bin/ In mijn geval is dat map /usr/local/bin/SQLAlchemy-1.2.12
  • python setup.py install - Alleen C-gedeelte lukt niet
  • Test: Ga naar een andere map (m'n projetmap in dit geval):
python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlalchemy
>>> sqlalchemy.__version__
'1.2.12'

Uninstall (jan. 2019 - Python 2.7)

Dit gaf een permissie-foutmelding:

pip uninstall sqlalchemy

/home/strompf/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
Uninstalling SQLAlchemy-1.2.12:
  Would remove:
    /usr/local/lib/python2.7/dist-packages/SQLAlchemy-1.2.12-py2.7-linux-x86_64.egg

Exception:
Traceback (most recent call last):
  File "/home/strompf/.local/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/home/strompf/.local/lib/python2.7/site-packages/pip/_internal/commands/uninstall.py", line 75, in run
    auto_confirm=options.yes, verbose=self.verbosity > 0,
  File "/home/strompf/.local/lib/python2.7/site-packages/pip/_internal/req/req_install.py", line 683, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/home/strompf/.local/lib/python2.7/site-packages/pip/_internal/req/req_uninstall.py", line 224, in remove
    renames(path, new_path)
  File "/home/strompf/.local/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 280, in renames
    shutil.move(old, new)
  File "/usr/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-1.2.12-py2.7-linux-x86_64.egg'

Dit werkte wel:

cd /home/strompf/.local/bin
sudo pip uninstall sqlalchemy

/home/strompf/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
The directory '/home/strompf/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Uninstalling SQLAlchemy-1.2.12:
  Would remove:
    /usr/local/lib/python2.7/dist-packages/SQLAlchemy-1.2.12-py2.7-linux-x86_64.egg
Proceed (y/n)? y
  Successfully uninstalled SQLAlchemy-1.2.12

Installatie SQLAlchemy (jan. 2019 - Python 3.x)

Dit lijkt niet te werken, want het installeert voor Python 2.7:

pip install sqlalchemy
/home/strompf/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
Collecting sqlalchemy
  Downloading https://files.pythonhosted.org/packages/05/d2/17fb194f4ae83577258ea1d81da3d5d5643f4957fa14fd0261d78d648bf5/SQLAlchemy-1.2.16.tar.gz (5.7MB)
    100% |████████████████████████████████| 5.7MB 10.0MB/s 
Installing collected packages: sqlalchemy
  Running setup.py install for sqlalchemy ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p1Hf3p/sqlalchemy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ciOy3f/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/sqlalchemy
    copying lib/sqlalchemy/pool.py -> build/lib.linux-x86_64-2.7/sqlalchemy
...
    copying lib/sqlalchemy/dialects/mssql/information_schema.py -> build/lib.linux-x86_64-2.7/sqlalchemy/dialects/mssql
    running build_ext
    building 'sqlalchemy.cprocessors' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/lib
    creating build/temp.linux-x86_64-2.7/lib/sqlalchemy
    creating build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/processors.c -o build/temp.linux-x86_64-2.7/lib/sqlalchemy/cextension/processors.o
    lib/sqlalchemy/cextension/processors.c:10:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    ***************************************************************************
    command 'x86_64-linux-gnu-gcc' failed with exit status 1
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Failure information, if any, is above.
    Retrying the build without the C extension now.
    ***************************************************************************
    running install
    running build
    running build_py
    running build_ext
    running install_lib
    creating /usr/local/lib/python2.7/dist-packages/sqlalchemy
    error: could not create '/usr/local/lib/python2.7/dist-packages/sqlalchemy': Permission denied
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p1Hf3p/sqlalchemy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ciOy3f/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-p1Hf3p/sqlalchemy/