segunda-feira, 3 de maio de 2021

Running setup.py install for pythonnet ... error

Durante a instalação do toga no Python 3.9.4, Windows 10,  me deparei com erro na instalação do pacote pythonnet-2.5.2.tar.gz e pycparser-2.20-py2.py3-none-any.whl e consegui resolver conforme segue:


Log de erro

 C:\Python\Sources>pip install toga

Collecting toga

  Downloading toga-0.2.15-py3-none-any.whl (4.3 kB)

Collecting toga-winforms

  Downloading toga_winforms-0.2.15-py3-none-any.whl (13 kB)

Collecting pythonnet

  Downloading pythonnet-2.5.2.tar.gz (1.9 MB)

     |████████████████████████████████| 1.9 MB 2.2 MB/s

Collecting toga-core>=0.2.15

  Downloading toga_core-0.2.15-py3-none-any.whl (413 kB)

     |████████████████████████████████| 413 kB 3.2 MB/s

Collecting colosseum>=0.1.6

  Downloading colosseum-0.2.0-py3-none-any.whl (261 kB)

     |████████████████████████████████| 261 kB 6.4 MB/s

Collecting pycparser

  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)

     |████████████████████████████████| 112 kB 3.3 MB/s

Using legacy 'setup.py install' for pythonnet, since package 'wheel' is not installed.

Installing collected packages: pycparser, colosseum, toga-core, pythonnet, toga-winforms, toga

    Running setup.py install for pythonnet ... error

    ERROR: Command errored out with exit status 1:

     command: 'c:\python\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users

\\Administrador\\AppData\\Local\\Temp\\pip-install-u3kxff6r\\pythonnet_92154425163b4c819b48363071d49231\\setup.py'

"'"'; __file__='"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-u3kxff6r\\pythonnet_92154425163b4c

819b48363071d49231\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__

) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\

n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Administrador\AppData\

Local\Temp\pip-record-mbawo0ql\install-record.txt' --single-version-externally-managed --compile --install-headers

 'c:\python\Include\pythonnet'

         cwd: C:\Users\Administrador\AppData\Local\Temp\pip-install-u3kxff6r\pythonnet_92154425163b4c819b48363071d

49231\

    Complete output (6 lines):

    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: setup.py --help [cmd1 cmd2 ...]

       or: setup.py --help-commands

       or: setup.py cmd --help

    

    error: option --single-version-externally-managed not recognized

    ----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python\python.exe' -u -c 'import io, os, sys, setuptools, token

ize; sys.argv[0] = '"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-u3kxff6r\\pythonnet_9215442516

3b4c819b48363071d49231\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-u

3kxff6r\\pythonnet_92154425163b4c819b48363071d49231\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__f

ile__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read

().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record

 'C:\Users\Administrador\AppData\Local\Temp\pip-record-mbawo0ql\install-record.txt' --single-version-externally-ma

naged --compile --install-headers 'c:\python\Include\pythonnet' Check the logs for full command output.


C:\Python\Sources>pip install toga

Collecting toga

  Using cached toga-0.2.15-py3-none-any.whl (4.3 kB)

Collecting toga-winforms

  Using cached toga_winforms-0.2.15-py3-none-any.whl (13 kB)

Requirement already satisfied: toga-core>=0.2.15 in c:\python\lib\site-packages (from toga-winforms->toga) (0.2.15

)

Collecting pythonnet

  Using cached pythonnet-2.5.2.tar.gz (1.9 MB)

Requirement already satisfied: colosseum>=0.1.6 in c:\python\lib\site-packages (from toga-core>=0.2.15->toga-winfo

rms->toga) (0.2.0)

Requirement already satisfied: pycparser in c:\python\lib\site-packages (from pythonnet->toga-winforms->toga) (2.2

0)

Using legacy 'setup.py install' for pythonnet, since package 'wheel' is not installed.

Installing collected packages: pythonnet, toga-winforms, toga

    Running setup.py install for pythonnet ... error

    ERROR: Command errored out with exit status 1:

     command: 'c:\python\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users

\\Administrador\\AppData\\Local\\Temp\\pip-install-s7plpy38\\pythonnet_37c80c063cc24884bce7558b1edf8950\\setup.py'

"'"'; __file__='"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-s7plpy38\\pythonnet_37c80c063cc248

84bce7558b1edf8950\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__

) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\

n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Administrador\AppData\

Local\Temp\pip-record-retls16y\install-record.txt' --single-version-externally-managed --compile --install-headers

 'c:\python\Include\pythonnet'

         cwd: C:\Users\Administrador\AppData\Local\Temp\pip-install-s7plpy38\pythonnet_37c80c063cc24884bce7558b1ed

f8950\

    Complete output (6 lines):

    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: setup.py --help [cmd1 cmd2 ...]

       or: setup.py --help-commands

       or: setup.py cmd --help

    

    error: option --single-version-externally-managed not recognized

    ----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python\python.exe' -u -c 'import io, os, sys, setuptools, token

ize; sys.argv[0] = '"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-s7plpy38\\pythonnet_37c80c063c

c24884bce7558b1edf8950\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-s

7plpy38\\pythonnet_37c80c063cc24884bce7558b1edf8950\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__f

ile__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read

().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record

 'C:\Users\Administrador\AppData\Local\Temp\pip-record-retls16y\install-record.txt' --single-version-externally-ma

naged --compile --install-headers 'c:\python\Include\pythonnet' Check the logs for full command output.


C:\Python\Sources>pip install toga

Collecting toga

  Using cached toga-0.2.15-py3-none-any.whl (4.3 kB)

Collecting toga-winforms

  Using cached toga_winforms-0.2.15-py3-none-any.whl (13 kB)

Requirement already satisfied: toga-core>=0.2.15 in c:\python\lib\site-packages (from toga-winforms->toga) (0.2.15

)

Collecting pythonnet

  Using cached pythonnet-2.5.2.tar.gz (1.9 MB)

Requirement already satisfied: colosseum>=0.1.6 in c:\python\lib\site-packages (from toga-core>=0.2.15->toga-winfo

rms->toga) (0.2.0)

Requirement already satisfied: pycparser in c:\python\lib\site-packages (from pythonnet->toga-winforms->toga) (2.2

0)

Using legacy 'setup.py install' for pythonnet, since package 'wheel' is not installed.

Installing collected packages: pythonnet, toga-winforms, toga

    Running setup.py install for pythonnet ... error

    ERROR: Command errored out with exit status 1:

     command: 'c:\python\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users

\\Administrador\\AppData\\Local\\Temp\\pip-install-bmgcmii_\\pythonnet_200c30b5cca545cb9a772e89a6f374d2\\setup.py'

"'"'; __file__='"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-bmgcmii_\\pythonnet_200c30b5cca545

cb9a772e89a6f374d2\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__

) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\

n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Administrador\AppData\

Local\Temp\pip-record-br7zpod6\install-record.txt' --single-version-externally-managed --compile --install-headers

 'c:\python\Include\pythonnet'

         cwd: C:\Users\Administrador\AppData\Local\Temp\pip-install-bmgcmii_\pythonnet_200c30b5cca545cb9a772e89a6f

374d2\

    Complete output (6 lines):

    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: setup.py --help [cmd1 cmd2 ...]

       or: setup.py --help-commands

       or: setup.py cmd --help

    

    error: option --single-version-externally-managed not recognized

    ----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python\python.exe' -u -c 'import io, os, sys, setuptools, token

ize; sys.argv[0] = '"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-bmgcmii_\\pythonnet_200c30b5cc

a545cb9a772e89a6f374d2\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrador\\AppData\\Local\\Temp\\pip-install-b

mgcmii_\\pythonnet_200c30b5cca545cb9a772e89a6f374d2\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__f

ile__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read

().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record

 'C:\Users\Administrador\AppData\Local\Temp\pip-record-br7zpod6\install-record.txt' --single-version-externally-ma

naged --compile --install-headers 'c:\python\Include\pythonnet' Check the logs for full command output.


Solução

A primeira coisa que fiz foi limpar a pasta C:\Users\Administrador\AppData\Local\Temp

Observe que no meu caso estava com o usuário Administrador, e na sequência fiz update/install com os comandos a seguir:


> pip install pip --upgrade

Requirement already satisfied: pip in c:\python\lib\site-packages (21.1.1)


> pip install setuptools --upgrade

Requirement already satisfied: setuptools in c:\python\lib\site-packages (49.2.1)
Collecting setuptools
  Downloading setuptools-56.0.0-py3-none-any.whl (784 kB)
     |████████████████████████████████| 784 kB 2.2 MB/s
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 49.2.1
    Uninstalling setuptools-49.2.1:
      Successfully uninstalled setuptools-49.2.1
Successfully installed setuptools-56.0.0

> pip install pycparser
Requirement already satisfied: pycparser in c:\python\lib\site-packages (2.20)


E finalmente tentando nova instalação do toga

> pip install toga

C:\Python\Sources>pip install toga
Collecting toga
  Using cached toga-0.2.15-py3-none-any.whl (4.3 kB)
Collecting toga-winforms
  Using cached toga_winforms-0.2.15-py3-none-any.whl (13 kB)
Collecting pythonnet
  Using cached pythonnet-2.5.2.tar.gz (1.9 MB)
Requirement already satisfied: toga-core>=0.2.15 in c:\python\lib\site-packages (from toga-winforms->toga) (0.2.15
)
Requirement already satisfied: colosseum>=0.1.6 in c:\python\lib\site-packages (from toga-core>=0.2.15->toga-winfo
rms->toga) (0.2.0)
Requirement already satisfied: pycparser in c:\python\lib\site-packages (from pythonnet->toga-winforms->toga) (2.2
0)
Building wheels for collected packages: pythonnet
  Building wheel for pythonnet (setup.py) ... done
  Created wheel for pythonnet: filename=pythonnet-2.5.2-cp39-cp39-win_amd64.whl size=79992 sha256=325f19135f1b66a3
a2af795a9444532b6a8af941e3114fc9c4be64a7148cf8ca
  Stored in directory: c:\users\administrador\appdata\local\pip\cache\wheels\2c\15\9c\554e578042cc422d36f134b642ed
4e8c9a5223a54dd6cc8749
Successfully built pythonnet
Installing collected packages: pythonnet, toga-winforms, toga
Successfully installed pythonnet-2.5.2 toga-0.2.15 toga-winforms-0.2.15


Espero que ajude, e se lhe ajudou comente!!!


quarta-feira, 21 de março de 2012

Pasta System Volume Information

Quem já não tentou entrar nessa pasta System Volume Information que atire a primeira pedra!!!

Ai vem aquela mensagem chata seguida de som que você não tem permissão.   Affe, como não tem permissão ? O micro é meu, o Windows é meu (é pirata, mas é meu rsrsr), e eu faço o que quiser então eu tenho todo o direito de saber o que tem dentro:

Vá no menu Iniciar e cliente em executar, então digite CMD, e de enter, na linha de comando digite:

attrib -s -h -r "c:\System Volume Information" /s /d

Depois disso, pode ir no Windows Explorer para ver o conteúdo.

As pastas RPxxx  (por exemplo RP120) são os pontos de restauração que o windows cria, estes até podem ser apagados.  Dentro deste diretório também encontrará arquivos .cfg que contém informações sobre as partições do sistema, muito utilizada no carregamento do windows e arquivos .txt

Observação: Reforçando pastas RPs podem até ser apagadas para liberar espaço em disco, já os arquivos .txt e .cfg que encontram-se dentro deste diretório NÃO APAGUE.

Problemas para receber emails

Outro dia um usuário de um cliente ligou reclamando porque não conseguia receber os emails disparados por uma aplicação, no entanto, o seu outlook conseguia ler/enviar emails normalmente sendo que utilizava o mesmo provedor de emails.  Se você tiver um problema similar veja se no servidor de sua sua aplicação é realizado com sucesso os comandos abaixo:

-Porta Normal
telnet smtp.seudominio.com.br 25

-Porta Segura
telnet smtp.seudominio.com.br 587

Caso o telnet funcione é porque existe alguma diretiva de segurança no seu servidor impedindo a conexão.

segunda-feira, 19 de março de 2012

Ping com Data e Hora

Gente para tudo!!! Chega de sofrimento. Chega de perda de tempo. Chega de pesquisar foruns e baixar mil e uma ferramentas para ter um ping com data e hora.  Simples:

ping -s 1 localhost   

Caso queira jogar num .txt

ping -s 1 localhost >c:\testeip.txt

Caso queria deixar rodando infinito (até um CTRL+C):

ping -t -s 1 localhost >c:\testeip.txt

outro exemplo:

ping -t -s 1 http://www.google.com/  >c:\testeip.txt