Upgrade with Python3.7.4 version in miniconda docker image - python

There is some security regression was discovered in python 3.7.3, which still allows an attacker to exploit.
An issue was discovered in urllib2 in Python. CRLF injection is possible if the attacker controls a url parameter, as demonstrated by the first argument to urllib.request.urlopen with \r\n (specifically in the query string after a ? character) followed by an HTTP header or a Redis command.
Below are the refrences for the issue:
[https://bugs.python.org/issue30458][1]
[https://bugs.python.org/issue33529][1]
[https://bugs.python.org/issue35755][1]
https://bugs.python.org/issue35907
https://bugs.python.org/issue36742
https://bugs.python.org/issue37463
The solution is to use Python 3.7.4 , which is released 9th of july 2019. But conda distribution is not released yet for python 3.7.4.
Now the question is:- Is there any way to upgrade python with python-3.7.4 in miniconda docker image container?
Docker file is : -
FROM continuumio/miniconda3:4.6.14
I tried to put upgrade python command in docker file but it fails as Python 3.7.4 is not available in conda distribution
repo.anaconda.com/pkgs/main/linux-64

Related

TypeError: an integer is required (got type bytes) when running server

I am attempting to run a Python Flask server in Git Bash. When running this server outside of Git Bash, I use PyCharm and I have no issues. However, I am attempting to deploy my program into a server and am using Git Bash for that. I have done everything else perfectly and running the server in Git Bash is the last step required in my deployment. I believe the error is my Python version and I am following a tutorial video where in the video, the user is using Python 3.6.9 while my Git Bash, by default, is using Python 3.8.10. I have tried to change my Git Bash python version down to 3.6.9 but I have not found a good tutorial or steps on how to do that.
Requirement.txt has:
Flask==1.0.2
numpy==1.20.0
scikit-learn==0.20.3
This is the error I get when attempting to run my server.py
Any help would be greatly appreciated! Thank you
EDIT: I got it to work after simply updating the scikit-learn module to version 0.24.1
Updating scikit-learn module to version 0.24.1 solves this issue

Returns JSII error when attempting to create empty stack with python AWS CDK

aws cdk returns jsii error on empty stack. Steps to reproduce are at the hello world level which makes me think that I have a version mismatch somewhere. I have re-installed aws cli, cdk and nodejs. Any suggestions on what to look for?
Steps to reproduce:
mkdir myfolder
cdk init --language python
.env\Scripts\activate.ps1
python -m pip install -r requirements.txt
cdk synth
Returns error AND an empty stack:
(.env) p$[myfolder]> cdk synth d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13295
throw e;
^
Error: EOF: end of file, read
at Object.readSync (fs.js:592:3)
at SyncStdio.readLine (d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13278:33)
at InputOutput.read (d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13203:34)
at KernelHost.run (d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13021:32)
at Immediate.<anonymous> (d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13029:37)
at processImmediate (internal/timers.js:461:21) {
errno: -4095,
syscall: 'read',
code: 'EOF'
}
Resources:
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Modules: aws-cdk=1.69.0,#aws-cdk/cloud-assembly-schema=1.69.0,#aws-cdk/core=1.69.0,#aws-cdk/cx-api=1.69.0,#aws-cdk/region-info=1.69.0,jsii-runtime=Python/3.7.4
Metadata:
aws:cdk:path: myfolder/CDKMetadata/Default
Condition: CDKMetadataAvailable
Environment
- **CLI Version :aws-cli/2.0.61 Python/3.7.7 Windows/10 exe/AMD64
- **cdk Version:1.69.0 (build 2b474b9)
- **Node.js Version:v14.15.0
- **OS :Windows 10
- **Language (Version):python 3.7.4
Saw this error when I first started on cdk. But, 'cdk synth' showed a stack, so I pressed on. I was even able to 'cdk deploy' simple stacks. Eventually, as the code became only slightly more complex, jsii errors prevent stack creation. Code created by me throws errors on my machine but does NOT error on other machines. Working cdk code from other devs will not synth or deploy stacks on my machine.
So far, I have re-installed aws cli, node.js and cdk. Any ideas where the jsii error originate or how to fix them?
For AWS-CDK on Windows, there is at least one bug in jsii documented by AWS CDK group. Deep inside the jsiiruntime (line 13278 to be exact), aws cdk group has a comment with a link to a nodejs bug report. I reported my problem to aws-cdk which seemed to be related. They reproduced the bug and created a bug report at nodejs. This bug report has links to the other bug reports. https://github.com/aws/aws-cdk/issues/11314
But I still needed a workaround. After much trial and error, the following 2 workarounds should work for AWS-CDK on Windows.
Workaround 1: replace jsii 1.14.x distro in site-packages with 1.12 or 1.13 distro. After swapping out 1.14 for 1.12 or 1.13, errors stop. Getting a distro is a trick. You will have to get one from someone who has not upgraded or run pip -- which what I did.
Workaround 2: move dev environment off Windows and onto linux or mac
TL;DR. Expanded work arounds. (A question was asked in the AWS-CDK bug report noted above).
Workaround 1: replace jsii 1.14.x distro
Distro folders: jsii is contained in 2 folders
jsii and jsii-1.14.1.dist-info
REPLACE both of these folders with folders from an older install -- 1.12 or 1.13.
The distro folders can be found in one or both of the following locations:
Distro location virtual environment: jsii distro will be found in the site-packages directory. Example:
.env\lib\python3.8\site-packages
where virtual environment name = .env, python version = 3.8
Distro location non-virtual: This should be the location if you have not created a virtual environment. Note that, again, the python version is part of the path.
C:\Program Files\Python37\Lib\site-packages
Note: for some reason, they were not installed here. But, that may change, so keep this in mind.
C:\Users\yourusername\AppData\Roaming\Python\Python37\site-packages
Workaround 2: move to linux
In windows, install WSL 2.
Install Ubuntu or your favorite linux variety.
Install python
Use your favorite Windows IDE from Windows! I use Visual Studio Code. Requires installing an extension if I remember correctly.
WARNING: I had problems when trying to run python, cdk, etc where the files were on the Windows system (ex: /mnt/d/project). Just copy the repo to the "pure" linux file system ( ex: ~/project). I have git installed on the linux side and maintain my files as if it were a separate machine.

Trouble installing scikit-bio on Windows

When attempting to install the scikit-bio toolkit via pip on Windows XP using Python 2.78 and Visual C++ 2008 Express Edition, the process is interrupted with the following message issued by VC:
cl : Command line error D8021 : invalid numeric argument '/Wno-error=declaration
-after-statement'
Concerning this error, Microsoft Developer Network website just says:
invalid numeric argument 'number'
A number greater than 65,534 was specified as a numeric argument.
I did not (yet) attempted to install scikit-bio under Linux (Ubuntu 12.04 Precise), but I am under the impression that it will work fine (as everything goes as regards Linux).
Has anyone ever succeeded installing scikit-bio under Windows (XP, 7, 8)? Any hints?
Thanks in advance!
I've installed Anaconda's Python (3.5) on a Windows 10 machine. As you should know, there is no official version of scikit-bio for this platform, but you can install it with this workaround:
Download the latest source from the Scikit-bio Github repository.
Using a tool like 7-zip, unzip it at your home directory.
Open a command line client and change to the source's directory
cd %HOMEPATH%\scikit-bio-master
Using Notepad++ edit the file setup.py
"C:\Program Files (x86)\Notepad++\notepad++" setup.py
Look for the line where the ssw_extra_compile_args variable is defined and change it. You can comment the previous version and redefine the variable in a new line:
#ssw_extra_compile_args = ['-Wno-error=declaration-after-statement']
ssw_extra_compile_args = []
Save the changes, close the editor and run the installation with this command:
python setup.py install
Hopefully you won't receive any error messages. Open an Anaconda's Python session (using the command python) and test if Scikit-Bio was installed rightly using print(skbio.art).
By the way, I've previously installed Visual Studio 2015 Community Edition with C++ SDK features enabled, in order to meet the compiler requirements for the package (Scikit-Bio) installation.
At this time, scikit-bio doesn't officially support windows. We'd definitely be interested in hearing about people's efforts to install, test, and use scikit-bio on Windows, but we don't have developers with expertise in this area.
This is related to biocore/skbio#941.

Verify thread-safety MySQLdb (Python) prior to Trac installation

I'm trying to install Trac manually for the first time. I don't want to use a one-click-installer like Bitmani, I want to learn how to install Trac manually, so I'm following the instructions carefully. I'm installing it in a Windows localhost for now, before installing it in a Linux environment.
As I follow the instructions carefully, I needed to install Python+MySQLDb, and I read this:
thread-safety is important
(...) verify that it is thread-safe by calling MySQLdb.thread_safe() from a standalone Python script (i.e., not under Apache). If the stand-alone test reports that MySQLdb is indeed thread-safe (...)
I've just installed MySQLDb 1.2.4 and I'd like to verify this. I've Googled but I haven't found an example about this, and I have no idea about Python. How can I verify if I've got a thread-safe installation?
Run this command. If you get 1 in the output, your installation is threadsafe.
python -c "import MySQLdb ; print MySQLdb.thread_safe()"

Using opscode's omnibus installer in windows 7

I am working my way through a video tutorial at http://gettingstartedwithdjango.com/en/lessons/introduction-and-launch/
I am working on win7 and using git-bash for my terminal. I have installed the latest virtualbox - 4.2.12 and the latest vagrant - 1.22.
I tried to run vagrant up and got: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
creating Makefile
make
sh: 1: make: not found
Once of the answers given by jtimberman is:
The basebox you're using does not have the "build-essential" package installed by default, and it has a "[shell provisioner][1]" that installs the Chef gem into the default Ruby environment. Chef has a dependency on the JSON RubyGem, which itself has C extensions that must be compiled. This is what is looking for `make`.
To resolve this issue, I'd recommend using Opscode's "omnibus" [full stack installer for Chef][2]. This can be used by changing the shell provisioner line to:
config.vm.provision :shell, :inline => "curl -L https://opscode.com/chef/install.sh | bash"
The `[install.sh][3]` script simply inspects the VM to determine what its platform is so it can retrieve the proper URL from an S3 bucket. If you prefer you can use the constructed URL to download the .deb file directly:
https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/11.04/x86_64/chef_11.4.4-2.ubuntu.11.04_amd64.deb
And then install it:
dpkg -i chef_11.4.4-2.ubuntu.11.04_amd64.deb
I have not been able to get the first method to work and would like to try the second. would:
dpkg -i chef_11.4.4-2.ubuntu.11.04_amd64.deb
work on win7. If not how do I get this working in windows?
In order to compile native extensions in Windows, you must install the Ruby DevKit. Joshua's answer is valid for Debian-based systems.
An addition to sethvargo.
In addition to the Ruby DevKit, you also need the client library for your native software.
For example, in order to compile/install ruby-oci8 gem, you should have the Oracle Client installed on your computer as well.

Categories