analitics

Pages

Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Sunday, October 1, 2023

Python 3.11.1 : PyScripter and Delphi VCL crash the python.

I tried to install PyScripter and Delphi VCL from embarcadero make this :
python.exe
Could  not find platform independent libraries <prefix>
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'python.exe'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = 'C:\Python311\Lib'
  sys._base_executable = 'C:\\Users\\catafest\\AppData\\Local\\Programs\\Python\\Python311\\python.exe'
  sys.base_prefix = 'C:\\Python311'
  sys.base_exec_prefix = 'C:\\Python311'
  sys.platlibdir = 'DLLs'
  sys.executable = 'C:\\Users\\catafest\\AppData\\Local\\Programs\\Python\\Python311\\python.exe'
  sys.prefix = 'C:\\Python311'
  sys.exec_prefix = 'C:\\Python311'
  sys.path = [
    'C:\\Users\\catafest\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip',
    'C:\\Python311\\DLLs',
    'C:\\Python311\\Lib',
    'C:\\Users\\catafest\\AppData\\Local\\Programs\\Python\\Python311',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000020 (most recent call first):
  <no Python frame>

Saturday, August 12, 2023

News : Colab behavior through runtime .

I would like Google to emphasize more on the development side some elements that work like robots by interfacing with the development side.
Today I worked a little on artificial intelligence and I realized that it doesn't create textgenrnn_weights.hdf5 file for training created with the Python textgenrnn mode.
A solution is to reset the runtime with Ctrl+M and resume running.
They specify RESTART RUNTIME when using Python modules, see:
WARNING: The following packages were previously imported in this runtime:
   [numpy]
You must restart the runtime in order to use newly installed versions.
In this case, with the creation of textgenrnn_weights.hdf5 file, it is more difficult to understand and cannot be seen easily.

Monday, June 26, 2023

Python : Fix error user on install with requirements.txt.

The error show like this :
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Python311\\share'
Consider using the `--user` option or check the permissions.
This can be easy fix with :
pip install -r requirements.txt --user
By using the --user flag, the packages will be installed in the user-specific site-packages directory, ensuring that the packages are installed only for the current user and not affecting the system-wide Python installation.

Saturday, January 28, 2023

Python : Fix error with pip and pylupdate6.exe .

I try to upgrade the PyQt6 package and I got this error:

pip3 install --upgrade --force-reinstall PyQt6
...
ERROR: Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified:
...pylupdate6.exe
...pylupdate6.exe.deleteme'
I think this solution will work for any python package
Open a command shell run as administrator and run it again:
pip3 install --upgrade --force-reinstall PyQt6
Collecting PyQt6
...
Successfully installed PyQt6-6.4.1 PyQt6-Qt6-6.4.2 PyQt6-sip-13.4.1
If you want to re-download the packages instead of using the files from your pip cache, then use:
pip install --force-reinstall --no-cache-dir

Tuesday, January 24, 2023

Python : Fix DLL load failed while importing ...

This error DLL load failed while importing ... can have many causes like conflicts with the already installed packages, and also it can break your current environment.
>>> import PyQt6
>>> from PyQt6.QtCore import QUrl
Traceback (most recent call last):
  ...
ImportError: DLL load failed while importing QtCore: The specified module could not be found.
You can see I used to reinstall the PyQt6 python package with this argument --ignore-installed:
pip3 install PyQt6 --user --ignore-installed
Collecting PyQt6
  ...
Installing collected packages: PyQt6-Qt6, PyQt6-sip, PyQt6
  WARNING: The scripts pylupdate6.exe and pyuic6.exe are installed in
  ...
  which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed PyQt6-6.4.0 PyQt6-Qt6-6.4.2 PyQt6-sip-13.4.0
The --ignore-installed option for the pip package manager was first introduced in version 6.0, which was released in April 2014.
The old install give me this error and when I try to use I got this:
>>> from PyQt6 import *
>>> dir(PyQt6)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
Now after I reinstall with this option the result is good:
>>> import PyQt6
>>> from PyQt6 import QtCore
>>> dir(PyQt6)
['QtCore', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'sip']
>>> from PyQt6.QtCore import QUrl

Monday, January 3, 2022

Python Qt6 : The basic differences between PyQt5 and PyQt6.

Python Qt6 known as PyQt6 is a binding of the cross-platform GUI toolkit Qt, implemented as a Python plug-in with Qt 6 the latest version of Qt.
The PyQt6 first stable release was on 6 January 2021, developed by Riverbank Computing Ltd and the last release was on 2 December 2021 with the version PyQt v6.2.2.
This release is license GPL or commercial on Python 3 platform.
Let's see some differences between PyQt5 and PyQt6.
The .exec() method is used in Qt to start the event loop of your QApplication or dialog boxes. In Python 2.7 exec was a keyword and Python 3 removed the exec keyword.
The first difference as a result of PyQt6 .exec() calls are named just as in Qt.
If you read the documentation from the official webpage, then in your PyQt6 source code you need to use these changes:
QEvent.Type.MouseButtonPress
...
Qt.MouseButtons.RightButton
...
Both PyQt5 and PyQt6, although seemingly easy to use for complex applications, will require extra effort.

Tuesday, May 26, 2020

Python Qt5 : PyQt5 and PyGame compatibility with source code.

This tutorial tries to solve from the objectives related to solving and stabilizing compatibility errors between PyQt4 and PyQt5 and creating a common interface between PyQt5 and PyGame.
There is always the same problem in programming when the developer for some reason has to change classes, methods and functions and reusing the old code is no longer valid.
In this case, common or other errors occur, which leads to a waste of time.
I will present a simple way to solve these problems.
I really like to use the PyQt5 module to create interfaces for my python programs and scripts.
Like any programmer who hasn't fully used all A.P.I, I always use the old source code I programmed in the past.
What the developer says about the transition from PyQt4 to PyQt5 we can see on the official page.
Obviously, you will have to move on to things to know but it is quite difficult to always come back and read this content when you have programming errors.
Today, I wanted to make a simple drawing interface in PyGame that would be included in a PyQt5 interface.
I tried to use an old code created by me in PyQt4 but I realized that I had encountered errors before switching to the new PyQt5.
This compatibility problem generates errors and can be solved as follows: by knowing the exact solution and fixing errors in real time, studying the changes created by the developer or the classic search for errors.
My solution comes with the help of these solutions and requires a simple step using the commented source code.
To show you how simple it is to understand I will show you the source code for the interface I built that simply to solves the problem of understanding compatibility by reading the developer source code with simple and useful comments.
#the old import for PyQt4
#from PyQt4 import QtGui

#the new import for PyQt5
#from PyQt5 import QtCore, QtGui, QtWidgets
#class MainWindow(QtWidgets.QMainWindow, UI.MainUI.Ui_MainWindow):

from PyQt5 import QtGui
from PyQt5 import QtWidgets
import pygame
import sys

# old definition for PyQt4 for QWidget
#class ImageWidget(QtGui.QWidget):
class ImageWidget(QtWidgets.QWidget):   
    def __init__(self,surface,parent=None):
        super(ImageWidget,self).__init__(parent)
        w=surface.get_width()
        h=surface.get_height()
        self.data=surface.get_buffer().raw
        self.image=QtGui.QImage(self.data,w,h,QtGui.QImage.Format_RGB32)

    def paintEvent(self,event):
        my_paint=QtGui.QPainter()
        # the definitions for PyQt4 and PyQt5 use QtGui.QPainter()     
        my_paint.begin(self)
        my_paint.drawImage(0,0,self.image)
        my_paint.end()
        
# old definition for PyQt4 for QMainWindow
#class MainWindow(QtGui.QMainWindow):
class MainWindow(QtWidgets.QMainWindow):
    def __init__(self,surface,parent=None):
        super(MainWindow,self).__init__(parent)
        self.setFixedSize(640, 480)
        self.setCentralWidget(ImageWidget(surface))
# this part of source code need to be updated if you want to use animation        
# init PyGame 
pygame.init()
# define a surface 
my_surface=pygame.Surface((640,480))
# fill the surface, see https://www.pygame.org/docs/ref/surface.html#pygame.Surface.fill
my_surface.fill((0,0,255,176))
# draw circle see https://www.pygame.org/docs/ref/draw.html#pygame.draw.circle
pygame.draw.circle(my_surface,(0,0,127,255),(76,76),76)
# draw ellipse (surface, color(R,G,B), size (x,y,x+dx, y+y+dy) )
pygame.draw.ellipse(my_surface,(127,0,0,0),(0,0,12,76))
 
# this part of source code will show 
# the my_surface created with PyGame in PyQt5
# old definition for PyQt4
#app=QtGui.QApplication(sys.argv)
app=QtWidgets.QApplication(sys.argv)
my_window=MainWindow(my_surface)
my_window.show()
app.exec_()

Friday, February 15, 2019

Install , test and fix error of the jupyter-book into python 3.

Jupyter Books lets you build an online book using a collection of Jupyter Notebooks and Markdown files. Its output is similar to the excellent Bookdown tool, and adds extra functionality for people running a Jupyter stack.
Read more about this on the official webpage.
Today I start to test this python module named jupyter-book.
I find some errors and I fixed to running well a demo jupyter-book instance.

C:\Python364\Scripts>pip install jupyter-book
Collecting jupyter-book
...
Installing collected packages: ruamel.yaml, jupyter-book
Successfully installed jupyter-book-0.4.1 ruamel.yaml-0.15.88
First I try to create a jupyter-book named catafest but I got this error:
C:\Python364>jupyter-book create catafest --demo
Traceback (most recent call last):
...
from nbclean import NotebookCleaner
ModuleNotFoundError: No module named 'nbclean'
The next step was to fix the error by install the nbclean python module and see all dependencies of python modules:
C:\Python364\Scripts>pip3.6.exe install nbclean
Collecting nbclean
...
Collecting nbgrader (from nbclean)
...
Collecting sqlalchemy (from nbgrader->nbclean)
...
Collecting alembic (from nbgrader->nbclean)
...
Collecting ipython<=6.2.1 (from nbgrader->nbclean)
...
Collecting jupyter-console<=5.2.0 (from nbgrader->nbclean)
...
Collecting Mako (from alembic->nbgrader->nbclean)
...
Collecting prompt-toolkit<2 .0.0="">=1.0.4 (from ipython<=6.2.1->nbgrader->nbclean)
...
Collecting prompt-toolkit<2 .0.0="">=1.0.4 (from ipython<=6.2.1->nbgrader->nbclean)
...
Building wheels for collected packages: nbgrader, sqlalchemy, alembic, Mako
...
Successfully built nbgrader sqlalchemy alembic Mako
Installing collected packages: sqlalchemy, Mako, python-editor, alembic, prompt-toolkit, ipython, 
jupyter-console, nbgrader, nbclean
...
Successfully installed Mako-1.0.7 alembic-1.0.7 ipython-6.2.1 jupyter-console-5.2.0 nbclean-0.3.2 
nbgrader-0.5.5 prompt-toolkit-1.0.15 python-editor-1.0.4 sqlalchemy-1.2.17 
Using again the jupyter-book to create catafest I got another error:
C:\Python364>jupyter-book create catafest--demo
Copying new book to: .\catafest
Copying over demo repository content
This is an error when I start to buid first time:
C:\Python364>jupyter-book build catafest
Convert and copy notebook/md files...
  0%|                                                                       | 0/35 [00:00
  File "c:\python364\lib\site-packages\jupyter_book\main.py", line 31, in main
    commands[args.command]()
  File "c:\python364\lib\site-packages\jupyter_book\build.py", line 266, in build_book
    lines = ff.readlines()
  File "c:\python364\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 183: character maps to  
The reason is the python 3.x and can be fixed by change the encoding into this file:
c:\python364\lib\site-packages\jupyter_book\build.py with this:
with open(path_new_file, 'r',encoding='utf-8') as ff:
The next step is to build the catafest jupyter-book:
C:\Python364>jupyter-book build catafest
Convert and copy notebook/md files...
... 
My GitHub account is catafest and I used this link to create a new repo named catafest_jupyter-book:
https://github.com/new
You need to use root folder use this commands:
C:\Python364\catafest>cd ..

C:\Python364>git clone https://github.com/catafest/catafest_jupyter-book
Cloning into 'catafest_jupyter-book'...
warning: You appear to have cloned an empty repository.
Copy all files and folders from catafest folder to catafest_jupyter-book folder and use GITHUB commands to upload to the web:
C:\Python364>cd catafest_jupyter-book

C:\Python364\catafest_jupyter-book>git add ./*

C:\Python364\catafest_jupyter-book>git commit -m "adding my first jupyter book!"

C:\Python364\catafest_jupyter-book>git push
Username for 'https://github.com': catafest
Password for 'https://catafest@github.com':
Enumerating objects: 347, done.
Counting objects: 100% (347/347), done.
Delta compression using up to 2 threads.
Compressing objects: 100% (304/304), done.
Writing objects: 100% (347/347), 1.40 MiB | 541.00 KiB/s, done.
Total 347 (delta 74), reused 0 (delta 0)
remote: Resolving deltas: 100% (74/74), done.
To https://github.com/catafest/catafest_jupyter-book
 * [new branch]      master -> master
You can make GITHUB settings with a new gh-pages branch to see into your browser.

Sunday, December 16, 2018

Fix errors when write files.

The python is a very versatile programming language.
The tutorial for today is about:
  • check the type of variables;
  • see the list error of writelines with the list output;
  • fix errors for writelines;
One good example for some errors can be this:
>>> file.writelines(paragraphs)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: a bytes-like object is required, not 'str'
>>> file.writelines(paragraphs.decode('utf-8'))
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'list' object has no attribute 'decode'
Is a common issue for list and writing file.
The result of paragraphs is a list, see:
>>> type(paragraphs)
The list can be write with te writelines into the file like this:
>>> file = open("out.txt","wb")
>>> file.writelines([word.encode('utf-8') for word in paragraphs])
The file is a open file variable and the paragraphs is a list.

Sunday, October 21, 2018

Using PyUSB with python 3.x .

C:\Python34\Scripts>pip3.4.exe install PyUSB
Downloading/unpacking PyUSB
  Running setup.py (path:C:\Users\mythcat\AppData\Local\Temp\pip_build_mythcat\PyUSB\setup.py) 
egg_info for package PyUSB

Installing collected packages: PyUSB
  Running setup.py install for PyUSB

Successfully installed PyUSB
Cleaning up...
Now you need to install this filter from here.
If not, you can get errors like this: raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available
Let's make a simple test example:
import usb.core
import usb.util
import sys

class find_class(object):
    def __init__(self, class_):
        self._class = class_
    def __call__(self, device):
        # first, let's check the device
        if device.bDeviceClass == self._class:
            return True
        # ok, transverse all devices to find an
        # interface that matches our class
        for cfg in device:
            # find_descriptor: what's it?
            intf = usb.util.find_descriptor(
                                        cfg,
                                        bInterfaceClass=self._class
                                )
            if intf is not None:
                return True

        return False

all = usb.core.find(find_all=1, custom_match=find_class(7))
print (all)
And show the result:
C:\Python34>python.exe usb_devs.py
< generator 0x0000000003d8d5e8="" at="" device_iter="" object="" >

Wednesday, August 29, 2018

PyOpenGL: Fix Attempt to call an undefined function glutInit .

This tutorial is about how to fix this error using Python version 3.6.4 :
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit,
check for bool(glutInit) before calling
First I start with a common pip3.6 install.
Scripts>pip3.6.exe install PyOpenGL
Collecting PyOpenGL
  Downloading https://files.pythonhosted.org/packages/9c/1d/4544708aaa89f26c97cc
09450bb333a23724a320923e74d73e028b3560f9/PyOpenGL-3.1.0.tar.gz (1.2MB)
    100% |████████████████████████████████| 1.2MB 1.2MB/s
Building wheels for collected packages: PyOpenGL
  Running setup.py bdist_wheel for PyOpenGL ... done
  Stored in directory: C:\Users\catafest\AppData\Local\pip\Cache\wheels\6c\00\7f
\1dd736f380848720ad79a1a1de5272e0d3f79c15a42968fb58
Successfully built PyOpenGL
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.0
When I run my python script code I got this error:
c:\Python364\Scripts>cd ..
c:\Python364>python.exe opengl_001.py
Traceback (most recent call last):
  File "opengl_001.py", line 182, in 
    StereoDepth().main()
  File "opengl_001.py", line 173, in main
    glutInit()
  File "c:\Python364\lib\site-packages\OpenGL\GLUT\special.py", line 333, in glu
tInit
    _base_glutInit( ctypes.byref(count), holder )
  File "c:\Python364\lib\site-packages\OpenGL\platform\baseplatform.py", line 40
7, in __call__
    self.__name__, self.__name__,
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit,
check for bool(glutInit) before calling
I use the whl files from here.
c:\Python364>cd Scripts

c:\Python364\Scripts>pip3.6.exe install PyOpenGL-3.1.2-cp36-cp36m-win_amd64.whl
Processing c:\python364\scripts\pyopengl-3.1.2-cp36-cp36m-win_amd64.whl
Installing collected packages: PyOpenGL
  Found existing installation: PyOpenGL 3.1.0
    Uninstalling PyOpenGL-3.1.0:
      Successfully uninstalled PyOpenGL-3.1.0
Successfully installed PyOpenGL-3.1.2

c:\Python364\Scripts>pip3.6.exe install PyOpenGL_accelerate-3.1.2-cp36-cp36m-win
_amd64.whl
Processing c:\python364\scripts\pyopengl_accelerate-3.1.2-cp36-cp36m-win_amd64.w
hl
Installing collected packages: PyOpenGL-accelerate
Successfully installed PyOpenGL-accelerate-3.1.2
This allow me to run well the python script with PyOpenGL python module.
This is result of shader stereo depth image:

Thursday, January 4, 2018

Python 2.7 : InsecurePlatformWarning error.

This is not a common error and can be solve it easy like any python issue.
The result of this error can be shown like into the next example:
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: 
SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension 
to TLS is not available on this platform. This may cause the server to present an incorrect TLS 
certificate, which can cause validation failures. You can upgrade to a newer version of Python to
 solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html
#snimissingwarning.
  SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: 
InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from
 configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade 
to a newer version of Python to solve this. For more information, see https://urllib3.readthe
docs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
The simple way to test this python error is to install these python modules:
pip install urllib3 
pip install requests
This last python module named requests to come with:
Successfully installed certifi-2017.11.5 chardet-3.0.4 idna-2.6 requests-2.18.4
What is this python module named requests?
Is a security the requests python module inject pyopenssl into urllib3
.
C:\Python27>python
Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> modules requests

Here is a list of matching modules.  Enter any module name to get more help.

pip._vendor.cachecontrol.controller - The httplib2 algorithms ported for use with requests.
pip._vendor.requests - Requests HTTP library
pip._vendor.requests.adapters - requests.adapters
pip._vendor.requests.api - requests.api
pip._vendor.requests.auth - requests.auth
pip._vendor.requests.certs - requests.certs
pip._vendor.requests.compat - requests.compat
pip._vendor.requests.cookies - requests.cookies
pip._vendor.requests.exceptions - requests.exceptions
pip._vendor.requests.hooks - requests.hooks
pip._vendor.requests.models - requests.models
pip._vendor.requests.packages
pip._vendor.requests.packages.chardet
pip._vendor.requests.packages.chardet.big5freq
pip._vendor.requests.packages.chardet.big5prober
pip._vendor.requests.packages.chardet.chardetect - Script which takes one or more file paths 
and reports on their detected
pip._vendor.requests.packages.chardet.chardistribution
pip._vendor.requests.packages.chardet.charsetgroupprober
pip._vendor.requests.packages.chardet.charsetprober
pip._vendor.requests.packages.chardet.codingstatemachine
pip._vendor.requests.packages.chardet.compat
pip._vendor.requests.packages.chardet.constants
pip._vendor.requests.packages.chardet.cp949prober
pip._vendor.requests.packages.chardet.escprober
pip._vendor.requests.packages.chardet.escsm
pip._vendor.requests.packages.chardet.eucjpprober
pip._vendor.requests.packages.chardet.euckrfreq
pip._vendor.requests.packages.chardet.euckrprober
pip._vendor.requests.packages.chardet.euctwfreq
pip._vendor.requests.packages.chardet.euctwprober
pip._vendor.requests.packages.chardet.gb2312freq
pip._vendor.requests.packages.chardet.gb2312prober
pip._vendor.requests.packages.chardet.hebrewprober
pip._vendor.requests.packages.chardet.jisfreq
pip._vendor.requests.packages.chardet.jpcntx
pip._vendor.requests.packages.chardet.langbulgarianmodel
pip._vendor.requests.packages.chardet.langcyrillicmodel
pip._vendor.requests.packages.chardet.langgreekmodel
pip._vendor.requests.packages.chardet.langhebrewmodel
pip._vendor.requests.packages.chardet.langhungarianmodel
pip._vendor.requests.packages.chardet.langthaimodel
pip._vendor.requests.packages.chardet.latin1prober
pip._vendor.requests.packages.chardet.mbcharsetprober
pip._vendor.requests.packages.chardet.mbcsgroupprober
pip._vendor.requests.packages.chardet.mbcssm
pip._vendor.requests.packages.chardet.sbcharsetprober
pip._vendor.requests.packages.chardet.sbcsgroupprober
pip._vendor.requests.packages.chardet.sjisprober
pip._vendor.requests.packages.chardet.universaldetector
pip._vendor.requests.packages.chardet.utf8prober
pip._vendor.requests.packages.urllib3 - urllib3 - Thread-safe connection pooling and re-using.
pip._vendor.requests.packages.urllib3._collections
pip._vendor.requests.packages.urllib3.connection
pip._vendor.requests.packages.urllib3.connectionpool
pip._vendor.requests.packages.urllib3.contrib
pip._vendor.requests.packages.urllib3.contrib.appengine
pip._vendor.requests.packages.urllib3.contrib.ntlmpool - NTLM authenticating pool, 
contributed by erikcederstran
pip._vendor.requests.packages.urllib3.contrib.pyopenssl
pip._vendor.requests.packages.urllib3.contrib.socks - SOCKS support for urllib3
pip._vendor.requests.packages.urllib3.exceptions
pip._vendor.requests.packages.urllib3.fields
pip._vendor.requests.packages.urllib3.filepost
pip._vendor.requests.packages.urllib3.packages
pip._vendor.requests.packages.urllib3.packages.ordered_dict
pip._vendor.requests.packages.urllib3.packages.six - Utilities for writing code that runs on 
Python 2 and 3
pip._vendor.requests.packages.urllib3.packages.ssl_match_hostname
pip._vendor.requests.packages.urllib3.packages.ssl_match_hostname._implementation - The match_hostname() 
function from Python 3.3.3, essential when using SSL.
pip._vendor.requests.packages.urllib3.poolmanager
pip._vendor.requests.packages.urllib3.request
pip._vendor.requests.packages.urllib3.response
pip._vendor.requests.packages.urllib3.util
pip._vendor.requests.packages.urllib3.util.connection
pip._vendor.requests.packages.urllib3.util.request
pip._vendor.requests.packages.urllib3.util.response
pip._vendor.requests.packages.urllib3.util.retry
pip._vendor.requests.packages.urllib3.util.ssl_
pip._vendor.requests.packages.urllib3.util.timeout
pip._vendor.requests.packages.urllib3.util.url
pip._vendor.requests.sessions - requests.session
pip._vendor.requests.status_codes
pip._vendor.requests.structures - requests.structures
pip._vendor.requests.utils - requests.utils
requests - Requests HTTP Library
requests.__version__
requests._internal_utils - requests._internal_utils
requests.adapters - requests.adapters
requests.api - requests.api
requests.auth - requests.auth
requests.certs - requests.certs
requests.compat - requests.compat
requests.cookies - requests.cookies
requests.exceptions - requests.exceptions
requests.help - Module containing bug report helper(s).
requests.hooks - requests.hooks
requests.models - requests.models
requests.packages
requests.sessions - requests.session
requests.status_codes
requests.structures - requests.structures
requests.utils - requests.utils
help>
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
>>>
...

Tuesday, December 5, 2017

Fix PyCharm error install python module from conda .

Today I fix an error about PyCharm and conda.
As you know :
Conda is an open source package management system and environmental management system that runs on Windows, macOS and Linux.
Also, Conda quickly installs, runs and updates packages dependency and environment management for any language—Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN.
This error is from PyCharm install python modules using error check from PyCharm (Alt+Enter keys):

The result of this install come with this error from conda :

Close your PyCharm and use this command into your shell-like administrator:

C:\WINDOWS\system32>conda config --show
C:\WINDOWS\system32>conda config --set force True
C:\WINDOWS\system32>conda update conda
C:\WINDOWS\system32>conda install conda anaconda
Fetching package metadata .............
Solving package specifications: .

# All requested packages already installed.
# packages in environment at C:\Users\catafest\Miniconda3:
#
anaconda                  5.0.1            py36h8316230_2
conda                     4.3.30           py36h7e176b0_0
C:\WINDOWS\system32>conda update --prefix C:\Users\catafest\Miniconda3 anaconda
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment C:\Users\catafest\Miniconda3:

The following packages will be UPDATED:

    conda-env: 2.6.0-0 --> 2.6.0-h36134e3_1
Proceed ([y]/n)? y

conda-env-2.6. 100% |###############################| Time: 0:00:00 163.59 kB/s
This command installs anaconda and updates it using my account catafest .
Start the I.D.E. PyCharm and after indexing all you can try to fix the python install module (Alt+Enter keys).
If the python modules are not into conda repo from PyCharm then you can use this command:
C:\WINDOWS\system32>conda install -c conda-forge opencv
Fetching package metadata ...............
Solving package specifications: .

# All requested packages already installed.
# packages in environment at C:\Users\catafest\Miniconda3:
#
opencv                    3.3.0                  py36_202    conda-forge
In this example I used OpenCV python module named into python script like cv2, see the next image:






Saturday, December 10, 2016

The python modules pygobject, pycairo and pygtk under Windows OS.

I used the python version 2.7 32 bits under .
C:\Python27>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (
Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

The issue is to instal PyGTK python module but you can see I got errors.
C:\>cd Python27

C:\Python27>cd script
The system cannot find the path specified.

C:\Python27>cd Scripts

C:\Python27\Scripts>pip install PyGTK
Collecting PyGTK
Downloading pygtk-2.24.0.tar.bz2 (2.4MB)
100% |################################| 2.4MB 224kB/s
Complete output from command python setup.py egg_info:
ERROR: Could not import dsextras module: Make sure you have installed pygobj
ect.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\my_account
\appdata\local\temp\pip-build-os60hf\PyGTK\

C:\Python27\Scripts>pip install pygobject
Collecting pygobject
Downloading pygobject-2.28.3.tar.bz2 (889kB)
100% |################################| 890kB 550kB/s
Complete output from command python setup.py egg_info:
ERROR: Could not find pkg-config: Please check your PATH environment variabl
e.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\my_account
\appdata\local\temp\pip-build-lt0gbh\pygobject\

I got the pygobject-2.28.3.win32-py2.7.msi, pycairo-1.8.10.win32-py2.7.msi and pygtk-2.24.0.win32-py2.7.msi from gnome website.
I install this python modules using registry and this option: Python from another location and I set my python path: C:\Python27\
>>> import gobject
>>> dir(gobject)
['GBoxed', 'GEnum', 'GError', 'GFlags', 'GInterface', 'GObject', 'GObjectMeta',
...
>>> import cairo
>>> dir(cairo)
['ANTIALIAS_DEFAULT', 'ANTIALIAS_GRAY', 'ANTIALIAS_NONE', 'ANTIALIAS_SUBPIXEL',
>>> import pygtk
>>> dir(pygtk)
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_
get_available_versions', '_our_dir', '_pygtk_2_0_dir', '_pygtk_dir_pat', '_pygtk
_required_version', 'fnmatch', 'glob', 'os', 'require', 'require20', 'sys']


As you can see this python modules works well.


Saturday, August 27, 2016

The python dizzy with clean instalation, is true !?

This will refer the python 2.7 working - but it can be extrapolated to other versions.
Many users have trouble installing python modules. The problem comes from old modules outdated or those who did not support.
I will present a few examples. I hope to come and support as necessary to remedy in time or exclusion through better solutions.
This is the main question for today: The python dizzy with clean instalation, is true !?
I don't think is a unwanted hacking of my python instalation using internet.
But I search and I saw many questions and erros over pip and Scripts folders.
I will deal just for this issue:
After I make one clean python 2.7 and all my python modules works well I used my windows to deal with some ssh software.
The next step I make it with python was to try to update with pip.
The strange think is with this files from Scripts folders:
12-Aug-16 06:41 PM 98,150 pyrsa-decrypt-bigfile.exe
12-Aug-16 06:41 PM 98,134 pyrsa-decrypt.exe
12-Aug-16 06:41 PM 98,150 pyrsa-encrypt-bigfile.exe
12-Aug-16 06:41 PM 98,134 pyrsa-encrypt.exe
12-Aug-16 06:41 PM 98,132 pyrsa-keygen.exe
12-Aug-16 06:41 PM 98,155 pyrsa-priv2pub.exe
12-Aug-16 06:41 PM 98,128 pyrsa-sign.exe
12-Aug-16 06:41 PM 98,132 pyrsa-verify.exe
and this file from same Script folder:
21-Jun-16 09:09 PM 0 python.exe
When I need to use pip I got errors.Then I try to fix with this:
pip install --upgrade ndg-httpsclient
and seem to be working now.
But I need to find from where come this file and why is this python file with:
C:\Python27\Scripts>python
Access is denied.
Maybe will be fix with a clean python instalation.
But the next step is and one of my concern is how to preserve this python instalation.
For example today the
pip update issue
come with many errors and this will be fixed.
Let's see how I fixed some of this.

First download Microsoft Visual C++ Compiler for Python 2.7.
This will fix this error:
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
.

If you got this error: RuntimeError: Freetype library not found
C:\Python27>Scripts\pip install freetype-py
Collecting freetype-py
Downloading freetype-py-1.0.2.tar.gz (394kB)
100% |################################| 399kB 758kB/s
Building wheels for collected packages: freetype-py
Running setup.py bdist_wheel for freetype-py ... done
You can see also this freetype-py will not working:
C:\Python27>python.exe
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import freetype
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\freetype\__init__.py", line 21, in
from freetype.raw import *
File "C:\Python27\lib\site-packages\freetype\raw.py", line 37, in
raise RuntimeError('Freetype library not found')
RuntimeError: Freetype library not found
Also some python module has into cloud dizzy stuff.
For example the pycryptodome come with many features and working great.
Also some alternative is a bad solution.
It is hard to find a solution to the problem of leaving all these modules.
Any solutions?

Thursday, May 7, 2015

The numpy - install over python 3.4 version.

The last version 1.9.2 of python module can solve instalation over python from sourceforge.net -projects.
This link from Numerical Python module come with exe file over python versions: 3.4 , 3.3 and 2.7.
I test the 3.4 version - 32 bits but I got this great error:
>>> import numpy
Traceback (most recent call last):
File "", line 1, in 
File "C:\Python34\lib\site-packages\numpy\__init__.py", line 170, in 
from . import add_newdocs
File "C:\Python34\lib\site-packages\numpy\add_newdocs.py", line 13, in 
from numpy.lib import add_newdoc
File "C:\Python34\lib\site-packages\numpy\lib\__init__.py", line 8, in 
from .type_check import *
File "C:\Python34\lib\site-packages\numpy\lib\type_check.py", line 11, in 
import numpy.core.numeric as _nx
File "C:\Python34\lib\site-packages\numpy\core\__init__.py", line 6, in 
from . import multiarray
ImportError: DLL load failed: %1 is not a valid Win32 application.
How to fix this:
Also the pip3.4 don't want to install the numpy python module just if you use this link.
You can do this with :
C:\Python34\Scripts>pip3.4.exe install --upgrade wheel
Requirement already up-to-date: wheel in c:\python34\lib\site-packages
C:\Python34\Scripts>pip3.4.exe install "C:\Users\...\Downloads\numpy-1.9.2+m
kl-cp34-none-win_amd64.whl"
After that you can import the numpy module 

Thursday, September 12, 2013

How to fix error: fatal error: Python.h: No such file or directory

This is a common error when your system don't have the python-dev.

I got this error when I try to use : pip .

Just install the package python-dev and then all will working well.

Saturday, August 10, 2013

Fix python error: SyntaxError: Non-ASCII character.

This can be fix easy ... just add the below line at top of the python file:
# coding: utf-8
You will see now something like this error:
SyntaxError: invalid syntax
... but also will be point to the bad encoding character with : ^
For example I had this:
usertest@home:~$ python sunet.py 
  File "sunet.py", line 22
    def  __init__ ( self , a , b , c ) :
                                 ^
SyntaxError: invalid syntax

Sunday, August 7, 2011

Python errors: numpy vs. Numeric

Today I decided to clarify some of the error that we met and I found a solution.

I created a new series called: Python errors

The first error occurs in trying to run scripts that require Numeric module.

You can run python 2.7 with numpy. But the Numeric module is not available in python 2.7 .

Such a script will try to import module:

import Numeric

and the next step will be something like:


s = Numeric.zeros((N,N),Numeric.Float32)
...
s = Numeric.zeros((N,N),Numeric.Int32)

The first error is :

    import Numeric
ImportError: No module named Numeric

Now , if you change from Numeric in numpy then you got this error:

    ... = numpy.zeros( (N,N),numpy.Float32 )
AttributeError: 'module' object has no attribute 'Float32'
To working well, just use this :
numpy.zeros( (N,N),float)
numpy.zeros( (N,N), int)

Actually, should be replaced :

numpy.Float32

with

float

The same applies for Int32 .