Django oscar docker: AttributeError: module 'os' has no attribute 'uname' - django

i used git clone https://github.com/django-oscar/django-oscar, then i used
pipenv install
and i got
AttributeError: module 'os' has no attribute 'uname' this error as well as this
pipenv.patched.notpip._internal.exceptions.InstallationError:
Command errored out with exit status 1:
python setup.py egg_info Check the logs for full command output.
I am using windows 10.

I guess this does not have a lot to do with docker but more with the host OS (win 10 in this case).
This question describes in more detail but it comes down to the fact that uname is not available on windows. Since docker containers use the kernels from the host OS they are run on, in your case this will error out.
The same error will appear if you run these commands in Windows 10 under the python Idle environment.

Related

Problems with requirement.txt when deploying flask app in AWS Elastic Beanstalk

I am trying to deploy my web app built with flask in python to elastic beanstalk. This is the first time I use this service and I am trying to upload it from the console of AWDS. However, the log file displays errors with the file requirements.txt, which I created from my local computer by typing "pip freeze > requirements.txt". This created me a 360 lines requirements file (is it not too much?) and the log displays errors like this one all the time like:
--------------------------------------------------------
2020/11/10 09:22:02.505005 [ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with requirements.txt file with error Command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt failed with error exit status 1. Stderr:ERROR: Could not find a version that satisfies the requirement anaconda-client==1.7.2 (from -r requirements.txt (line 5)) (from versions: 1.1.1, 1.2.2)
ERROR: No matching distribution found for anaconda-client==1.7.2 (from -r requirements.txt (line 5))
2020/11/10 09:22:02.505022 [INFO] Executing cleanup logic
2020/11/10 09:22:02.505119 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed to install application dependencies. The deployment failed.","timestamp":1605000122,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1605000122,"severity":"ERROR"}]}]}
---------------------------------------------------------
I deleted the entry "anaconda-client==1.7.2" and still does not work. Same problem as well with anaconda-navigator==1.9.12, anaconda-project==0.8.3, Automat==20.2.0... I erased them all but there is always a new wrong requirement.
I guess the requirements.txt file is just wrong... any ideas to solve the problem? Did I
create the requirements.txt correctly? Might it be any kind of problem with the enviroments?
thanks a lot

RuntimeError:This command is using a remote connection in offline mode.[CondaError]

when I've created environment into conda, I got this error just after Proceed response:
[root#MyServer]#conda create -n py26 python=2.6 anaconda --offline
Fetching package metadata .........
Solving package specifications: ..............
......................
....
...
Proceed ([y]/n)? y
CondaError: RuntimeError(u'EnforceUnusedAdapter called with url https://repo.continuum.io/pkgs/free/linux-64/jpeg-8d-0.tar.bz2\nThis command is using a remote connection in offline mode.\n',)
CondaError: RuntimeError(u'EnforceUnusedAdapter called with url https://repo.continuum.io/pkgs/free/linux-64/jpeg-8d-0.tar.bz2\nThis command is using a remote connection in offline mode.\n',)
CondaError: RuntimeError(u'EnforceUnusedAdapter called with url https://repo.continuum.io/pkgs/free/linux-64/jpeg-8d-0.tar.bz2\nThis command is using a remote connection in offline mode.\n',)
even that I can see that my env has created successfuly:
[root#MyServer]# conda env list
# conda environments:
#
py26 /opt/Anaconda/Anaconda2-4.4.0/envs/py26
py27 /opt/Anaconda/Anaconda2-4.4.0/envs/py27
root * /opt/Anaconda/Anaconda2-4.4.0
is that Error influence environement I have created?
After few hours of search I found out that this issue cames from a bug on the Conda version 4.3.x: Github
to fix this issue, you will have to install the Conda 4.4.x
also, you have to check out the UPDATE on this version to enable conda in your shel:

File not found error while testing python impyla

I am trying to set up a connection between python and impala. Based on the instructions here I am trying to set up impyla.
I am on a vagrant ubuntu/xenial64 box with python 2.7.12. After reading about some issues with the latest thrift I downgraded to the specified version. After pip installing and setting up the environment variables, I am trying to run the test but it is failing with the file not found error, as follows:
ubuntu#ubuntu-xenial:~/.local/lib/python2.7/site-packages/impala$ py.test --connect impyla
======================================== test session starts ========================================
platform linux2 -- Python 2.7.12, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /home/ubuntu/.local/lib/python2.7/site-packages/impala, inifile:
=================================== no tests ran in 0.00 seconds ====================================
ERROR: file not found: impyla
ubuntu#ubuntu-xenial:~/.local/lib/python2.7/site-packages/impala$
I think I am missing out on something very fundamental here. I have no previous experience with python tests. I would like to stick with python 2.7 because of some other dependencies.
PS:
Please note the latest version provided in the repo readme is 0.13.1 but with my pip install impyla it came out to be 0.14.0.
I am running the test from my site-package/impala directory as the readme says to be in the directory where impyla is.
There is no mention of any inifile in the readme (as far as I could see.)
EDIT 1:
When I run it from site-package directory without --connect I get the same error. But with the argument, it says that the argument is unrecognizable. The output is as follows:
ubuntu#ubuntu-xenial:~/.local/lib/python2.7/site-packages$ py.test --connect impyla
usage: py.test [options] [file_or_dir] [file_or_dir] [...]
py.test: error: unrecognized arguments: --connect
inifile: None
rootdir: /home/ubuntu/.local/lib/python2.7/site-packages
ubuntu#ubuntu-xenial:~/.local/lib/python2.7/site-packages$
Any help on how to troubleshoot this would be helpful.

xboost dmlc-submit eats command quotes (needed to run python job via scl enable)

I use RedHat 6.8 for my YARN cluster nodes, and it uses Python 2.6.6. In order to get Python 2.7 in RedHat one uses Software Collections. To activate a software collection one must do scl enable. To print Python version for example one does scl enable python27 'python -V'
Problem is when I try to submit my Python job to YARN as follows
dmlc-submit --cluster=yarn scl enable python27 'python -V'
It seems to eat up the quotes and produces this error (instead of the expected Python 2.7.8):
Unable to open /etc/scl/prefixes/python!
That is the same output one gets when doing following at the bash prompt on any machine
scl enable python27 python -V
I'm trying to figure out how to fool argparse into letting this through.
Looked into argparser (which dmlc-core and xgboost use) source code trying to figure out any possible escaping mechanism. Couldn't find any but did find out dmlc-submit picks up job submission node environment and recreates on each of the execution nodes. Looked at the scl enable and /opt/rh/python27/enable script and realized LD_LIBRARY_PATH is the important one. PATH is also but for some reason it doesn't carry over so I now specify full path to my SCL provided python27
Following now happily runs on my YARN 2.7.1 cluster
cd xgboost
dmlc-core/tracker/dmlc-submit --cluster=yarn --num-workers=9 --worker-cores=4 /opt/rh/python27/root/usr/bin/python tests/distributed/test_basic.py

macOS - vagrant up failed, /dev/vboxnetctl: no such file or directory

Can be useful, I found this error. The common solution is reinstall virtualbox but there are a better way.
Solution
sudo /Library/StartupItems/VirtualBox/VirtualBox restart
or
sudo /Library/StartupItems/VirtualBox/VirtualBox start
VirtualBox 4.3+
On recents versions, the file (/Library/StartupItems/VirtualBox/VirtualBox) don't exists, so you need to use the command below:
sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist
Error
Print: http://d.pr/i/1Bvi
There was on error while executing VBoxManage, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below
Command: ["hostonlyif", "create"]
Stderr: 0%... Progress state: NS_ERROR_FAILURE VBoxManage: error:
Failed to create the host-only adapter VBoxManage: error:
VBoxNetAdpCtl: Error while adding new interface: failed to open
/dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005),
component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)"
at line 68 of file VBoxManageHostonly.cpp
Vagrant Git issue about the error: https://github.com/mitchellh/vagrant/issues/1671#issuecomment-22304107
I'm running macOS High Sierra 10.13.1 and VirtualBox 5.2.2.
This worked for me:
Grant permission to VirtualBox under System Preferences > Security & Privacy > General (this request is new to macOS High Sierra)
Open Terminal and run: sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart
If your system recently updated the kernel, you many need to rerun the vbox setup again.
If this is the case, you will see the following messages when you run virtualbox start command:
$ sudo /path/to/virtualbox start
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (2.6.32-358.23.2.el6.x86_64) or it failed to
load. Please recompile the kernel module and install it by
sudo /etc/init.d/vboxdrv setup
You will not be able to start VMs until this problem is fixed.
This worked for me (macOS Monterey). This reloads all VirtualBox's kernel extensions.
sudo kmutil load -b org.virtualbox.kext.VBoxUSB
sudo kmutil load -b org.virtualbox.kext.VBoxNetFlt
sudo kmutil load -b org.virtualbox.kext.VBoxNetAdp
sudo kmutil load -b org.virtualbox.kext.VBoxDrv
I had some problems with vbox running on Ubuntu 17.10 when starting a virtual machine with host-only adapted/bridge network. Looking for an answer I found numerous commands that are useful when having that kind of problems. Here they are:
VIRTUAL HOST PROBLEMS
failed to open /dev/vboxnetctl
vboxnet0 - this is the bad guy who is causing all the trouble.
VBoxNetAdpCtl: Error while adding new interface: failed to open
/dev/vboxnetctl: No such file or directory.
These commands are not used in particular order. They are just generally useful and problem-solving.
1) sudo modprobe vboxdrv
2) sudo modprobe vboxnetadp - (host only interface)
3) sudo modprobe vboxnetflt - (make vboxnet0 accecible)
IF YOU HAVE PROBLEMS WITH SECURE BOOT RUNNING the FIRST COMMAND I RECOMMEND DISABLING SECURE BOOT IN BIOS (or reboot).
modprobe: FATAL: Module vboxnetftl not found in directory
/lib/modules/4.13.0-21-generic
(bridge networking)
4) sudo apt-get install virtualbox-dkms (extension) -> go to command 1 after this
5) sudo vboxmanage hostonlyif create
These sometimes might work:
I. service --status-all
II service service_name restart
Tried above all remedies, few commands although executed, did not work.
Nothing is present in my Mac (el captain) of sort /Library/StartupItems/Vir*, and below command failed:
sudo /Library/StartupItems/VirtualBox/VirtualBox restart
Reinstalling latest VirtualBox and then running below command helped me having VM running
sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist
I had a similar problem starting a virtual box on High Sierra.
macOS High Sierra 10.13 introduces a new feature that requires user approval before loading newly-installed third-party kernel extensions (KEXTs). When a request is made to load a KEXT that the user has not yet approved, the load request is denied. Apps or installers that treat a KEXT load failure as a hard error will need to be changed to handle this new case.
To resolve, you must manually approve the KEXT in System Preferences > Security & Privacy.
Here is the Technical Note from Apple:
https://developer.apple.com/library/content/technotes/tn2459/_index.html
I was stuck on this for a while. I kept seeing 'command not found' when trying to run the sudo: /Library.. command.
However, this did work for me:
sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart
RUN
$ sudo modprobe vboxdrv
$ sudo modprobe vboxnetadp
$ sudo vboxreload
Thank forks, it worked for me.
Grant permission to VirtualBox under System Preferences > Security & Privacy > General
Throw away /Applications/VirtualBox into the trash
Re-install VirtualBox from your .dmg file
When I get the error...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 68 of file VBoxManageHostonly.cpp
The following works for me and returns no errors, I am then able to bring vagrant up successfully
sudo /Library/StartupItems/VirtualBox/VirtualBox restart