Fedora Online Forum

Il forum della comunità italiana di Fedora

#1 24-07-2018 14:35:53

zcristiano
Pinguino avanzato
Registrato: 15-05-2009
Messaggi: 243

[Risolto] face recognition

Buongiorno a tutti, ho dei problemi nell'installazione del face-recognition

Versione fedora: Linux xps-13-9370 4.17.6-200.fc28.x86_64

Comando di installazione:

$ pip3 install face_recognition

Errore:

Collecting face_recognition
  Using cached https://files.pythonhosted.org/packages/28/10/f153bbbc218fc169768aa1c02f2e9178e9241e4af8da56289bdca2c0c217/face_recognition-1.2.2-py2.py3-none-any.whl
Collecting dlib>=19.7 (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/df/aa/6a9bb2a763107bb2606d6ee1aa65fcd3b51375a9ef6436e9c9280b0dd63c/dlib-19.15.0.tar.gz
Collecting numpy (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/88/29/f4c845648ed23264e986cdc5fbab5f8eace1be5e62144ef69ccc7189461d/numpy-1.15.0-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied: Pillow in /usr/lib64/python3.6/site-packages (from face_recognition)
Requirement already satisfied: face-recognition-models>=0.3.0 in /usr/local/lib/python3.6/site-packages (from face_recognition)
Collecting Click>=6.0 (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Installing collected packages: dlib, numpy, Click, face-recognition
  Found existing installation: dlib 19.4.0
    Uninstalling dlib-19.4.0:
Exception:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/shutil.py", line 544, in move
    os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/usr/lib64/python3.6/site-packages/dlib' -> '/tmp/pip-_p0jv2cu-uninstall/usr/lib64/python3.6/site-packages/dlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/usr/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/lib64/python3.6/shutil.py", line 556, in move
    rmtree(src)
  File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'dlib.so'

Ultima modifica di zcristiano (25-07-2018 16:34:48)

Non in linea

#2 24-07-2018 15:02:48

frafra
Amministratore
Da Trondheim (Norvegia)
Registrato: 14-05-2014
Messaggi: 2'351
Sito web

Re: [Risolto] face recognition

/tmp è montato con tmpfs, mentre /usr è su una partizione fisica, quindi il rename fallisce. E' un bug della libreria: sentiti libero di segnalarlo allo sviluppatore.
Imposta la variabile TMPDIR su una cartella differente.

Non in linea

#3 24-07-2018 15:16:40

zcristiano
Pinguino avanzato
Registrato: 15-05-2009
Messaggi: 243

Re: [Risolto] face recognition

grazie della risposta...pensavo di risolvere con un semplice set della variabile ma invece mi sbagliavo

$ export TMPDIR=/home/utente/tmp/
$ env|grep TMPDIR
TMPDIR=/home/utente/tmp/

Stesso identico errore all'esecuzione:

$ pip3 install face_recognition

...mi daresti qualche aiuto su come fare?
Grazie

Non in linea

#4 24-07-2018 21:26:14

frafra
Amministratore
Da Trondheim (Norvegia)
Registrato: 14-05-2014
Messaggi: 2'351
Sito web

Re: [Risolto] face recognition

Aspetta, scusa, tu stai lanciando pip come utente normale senza l'opzione per l'installazione utente... O lo lanci da root o lo lanci con --user
...oppure fai come me ed usi fades big_smile Oppure il solito virtualenv.

Non in linea

#5 25-07-2018 08:31:56

zcristiano
Pinguino avanzato
Registrato: 15-05-2009
Messaggi: 243

Re: [Risolto] face recognition

...avevo già provato anche con root ma il problema non cambia...help me, please!


[[email protected]]# pip3 install face_recognition
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting face_recognition
  Using cached https://files.pythonhosted.org/packages/28/10/f153bbbc218fc169768aa1c02f2e9178e9241e4af8da56289bdca2c0c217/face_recognition-1.2.2-py2.py3-none-any.whl
Collecting Click>=6.0 (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Requirement already satisfied: Pillow in /usr/lib64/python3.6/site-packages (from face_recognition)
Collecting numpy (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/88/29/f4c845648ed23264e986cdc5fbab5f8eace1be5e62144ef69ccc7189461d/numpy-1.15.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting dlib>=19.7 (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/df/aa/6a9bb2a763107bb2606d6ee1aa65fcd3b51375a9ef6436e9c9280b0dd63c/dlib-19.15.0.tar.gz
Requirement already satisfied: face-recognition-models>=0.3.0 in /usr/local/lib/python3.6/site-packages (from face_recognition)
Installing collected packages: Click, numpy, dlib, face-recognition
  Found existing installation: dlib 19.4.0
    Uninstalling dlib-19.4.0:
      Successfully uninstalled dlib-19.4.0
  Running setup.py install for dlib ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-56749l8e/dlib/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-rdf23cuz-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    package init file 'dlib/__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.6.5 (default, Mar 29 2018, 18:20:46)
    Invoking CMake setup: 'cmake /tmp/pip-build-56749l8e/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-build-56749l8e/dlib/build/lib.linux-x86_64-3.6 -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=Release'
    -- The C compiler identification is GNU 8.1.1
    -- The CXX compiler identification is unknown
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    CMake Error in CMakeLists.txt:
      No CMAKE_CXX_COMPILER could be found.
    
      Tell CMake where to find the compiler by setting either the environment
      variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
      to the compiler, or to the compiler name if it is in the PATH.
    
    
    -- Configuring incomplete, errors occurred!
    See also "/tmp/pip-build-56749l8e/dlib/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log".
    See also "/tmp/pip-build-56749l8e/dlib/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeError.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-56749l8e/dlib/setup.py", line 257, in <module>
        'Topic :: Software Development',
      File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib64/python3.6/distutils/command/install.py", line 556, in run
        self.run_command('build')
      File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-56749l8e/dlib/setup.py", line 133, in run
        self.build_extension(ext)
      File "/tmp/pip-build-56749l8e/dlib/setup.py", line 170, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-build-56749l8e/dlib/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-build-56749l8e/dlib/build/lib.linux-x86_64-3.6', '-DPYTHON_EXECUTABLE=/usr/bin/python3', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
    
    ----------------------------------------
  Rolling back uninstall of dlib
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-56749l8e/dlib/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-rdf23cuz-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-56749l8e/dlib/

Non in linea

#6 25-07-2018 12:01:37

bebo_sudo
Collaboratore
Da Trento+Trieste
Registrato: 28-02-2011
Messaggi: 1'874
Sito web

Re: [Risolto] face recognition

Ti manca un compilatore C++. Installa l'ambiente di sviluppo con:

# yum install @development

Noto che stai installando come root all'interno del python di sistema. Sei consapevole che se dovrai cambiare versione si romperanno gli script che usano quella vecchia?

frafra ha scritto:

Aspetta, scusa, tu stai lanciando pip come utente normale senza l'opzione per l'installazione utente... O lo lanci da root o lo lanci con --user
...oppure fai come me ed usi fades big_smile Oppure il solito virtualenv.


devzero.tk - github.com/bebosudo
Quando posti del codice, mettilo nel tag code! (senza spazi)            [ code]così[/ code]

Non in linea

#7 25-07-2018 13:09:10

zcristiano
Pinguino avanzato
Registrato: 15-05-2009
Messaggi: 243

Re: [Risolto] face recognition

Visto che mancava solo il gcc-c++ ho installato solo questo pacchetto

[[email protected] ~]# dnf install gcc-c++

..poi mancava anche il python-devel quindi l'ho installato

# dnf install python3-devel

e come suggerito ho rilanciato l'installazione ma con il parametro --user e adesso la compilazione è terminata correttamente

$ pip3 install --user face_recognition


13:40:21 [[email protected] ~]$ pip3 install --user face_recognition
Collecting face_recognition
  Using cached https://files.pythonhosted.org/packages/28/10/f153bbbc218fc169768aa1c02f2e9178e9241e4af8da56289bdca2c0c217/face_recognition-1.2.2-py2.py3-none-any.whl
Requirement already satisfied: Click>=6.0 in /usr/local/lib64/python3.6/site-packages (from face_recognition)
Requirement already satisfied: Pillow in /usr/lib64/python3.6/site-packages (from face_recognition)
Requirement already satisfied: face-recognition-models>=0.3.0 in /usr/local/lib/python3.6/site-packages (from face_recognition)
Collecting dlib>=19.7 (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/df/aa/6a9bb2a763107bb2606d6ee1aa65fcd3b51375a9ef6436e9c9280b0dd63c/dlib-19.15.0.tar.gz
Requirement already satisfied: numpy in /usr/local/lib64/python3.6/site-packages (from face_recognition)
Installing collected packages: dlib, face-recognition
  Running setup.py install for dlib ... done
Successfully installed dlib-19.15.0 face-recognition-1.2.2

Per chi volesse installare face_recognition segnalo che la compilazione è durata circa 3 minuti portando 'load everage a 6.8' e con 6 processi di compilazione al 99% CPU su un pc di queste caratteristiche:

- core i7-8850U 8th gen
- 16GB ram 

Potete chiudere il topic   smile

Grazie a tutti per l'aiuto!!

Non in linea

#8 25-07-2018 14:33:52

andreamal
Fedora nel sangue
Da Roma
Registrato: 16-12-2009
Messaggi: 1'677

Re: [Risolto] face recognition

zcristiano ha scritto:

Potete chiudere il topic   smile

Puoi chiuderlo anche tu modificando, nel primo post, il titolo facendolo precedere da [Risolto] wink


Ciao
Andrea Malfatti

Non in linea

Piè di pagina