VSCode with Remote Docker does not launch Anaconda base and does not recognize the conda command - containers

I use WSL2 and Desktop Container and my system is Windows 11. I create a container(the system used in the container is Ubuntu 20.04) and then connect the container with VSCode (remote docker). I have installed a miniconda in the container. But when I connected the container with VSCode, I can't use any conda commands. It seems that VSCode blocks the miniconda or doesn't recognize it. But I can use conda commands in this container if I access the container with "docker exec"(not with VSCode).
When I run "conda -h" in the VSCode, it shows the following information(conda does not work):
$ conda -h
bash: conda: command not found.
When I run "conda -h" in a container terminal(access with "docker exec"), it shows(conda works):
(base) root ➜ / $ conda -h
usage: conda [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
This problem may be similar to the problem which might cause by the VSCode while connecting a running container(VSCode does not launch Anaconda base Python).
But I have no idea why they happened.
Does anybody have any improvement to these problems? Thank you.
Python works all well in both cases.
The miniconda was installed into the Ubnutu system after I created the container. Is it the reason that VSCode does not recognize the conda commands?

I had problems with the same combination (vs code and anaconda) on Window 10.
In fact, there is a chance that you have to define your PATH variables for Anaconda and that it will work fine after that...
1. path\to\Anaconda\Scripts
2. path\to\Anaconda\Lib
3. path\to\Anaconda\
but it isn't the most elegant way. According to Anaconda the preferred way is working with a $PROFILE and $ENV VARIABLES
But on stackflow, are a lot of posts about similar problems I noticed:
Maybe in some of the comments you find your answer?
Conda: Creating a virtual environment
https://stackoverflow.com/questions/53137700/ssl-module-in-python-is-not-available-windows-7]
I hope you'll find it fast, probably something small and easy to change.
Like choosing the right terminal from VS Code or so...
Good luck!

Related

Where does cuda-repo-cross-<identifier>-all.deb come from?

I am trying to set up a cross-compile environment on an AWS EC2 Ubuntu box targeting Nvida Xavier devices on Cuda 10.2. I tried following the "instructions" at https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#cross-platform which say to install
sudo dpkg -i cuda-repo-cross-<identifier>_all.deb
but no clue as to where I might get hold of that .deb file, or what <identifier> should be replaced with. I have installed the native package cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb and there are a load of .deb files in /var/cuda-repo-10-2-local-10.2.89-440.33.01, but none of them are that one.
So it turns out that the instructions that can be found by googling for, for instance, "cuda install cross compile" are wrong, or at least so incomplete as makes no difference.
Instead, use the SDK manager https://developer.nvidia.com/nvidia-sdk-manager to install just the host tools. It does run without a GUI.

Install MySQL on Windows Docker Image

Anyone had success adding MySQL to a Windows docker image? I tried two different ways of deploying MySQL to my image.
I tried using the msi from MySQL in non-interactive mode. Does not work at all in a container.
While Installing Mysql.msi through powershell getting below error
I tried extracting the zip to set things up manually using the mysqld commands does nothing at all. Literally nothing, the exectutables behave as if they just run and exit (no output, nothing):
https://github.com/Somesh-K/Automation-Mysql/blob/main/1.mysql_setup_v2.ps1
Something is very weird about all of this.
Yes, I know that there's a perfectly good MySQL docker linux container published by Oracle to Docker hub. This works. The problem is that running a Windows container and Linux container that need to interact creates a really unnecessary frustration for the user in terms of networking between the two.
Using a different back-end (like SQL server) for our application is not feasible and using .NET core instead of .NET framework is not feasible. To simplify, I'd like to just install MySQL on our windows based webserver docker image. This seems do-able using the two methods described in the links above, but as noted, it does not work and there's very odd behavior from the MySQL binaries when they are run in the container.
Here's an example of the odd behavior:
Install Docker Desktop for Windows
Download the Win32 install zips from MySQL and place in C:\mydata
https://dev.mysql.com/downloads/mysql/
Pull down the ASPNET image from Docker Hub, Run it, and Open up Powershell:
# docker pull mcr.microsoft.com/dotnet/framework/aspnet:4.8
# docker run --name testweb -v C:\mydata:C:\mydata:R -d mcr.microsoft.com/dotnet/framework/aspnet:4.8
# docker exec -it testweb powershell
C:\ > cd C:\mydata
C:\mydata\ > Expand-archive -path .\mysql-5.7.36-winx64.zip .
C:\mydata\ > cd \mysql-5.7.36-winx64\bin
C:\mydata\mysql-5.7.36-winx64\bin\ > .\mysql.exe -version
[zero output, acts like it's an empty executable]
Results
None of the executables/binaries in the extracted mysql bin directory on the container do anything at all. They behave as if someone wrote and executable that just exits. I thought I had a bad install zip so I extracted the same zip on my regular Windows 10 workstation. All of the binaries at least return errors or do something.
This is super odd. Any help would be appreciated.
Downloading this executable and putting it into my container seemed to do the trick:
https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe
Placed this on my container and started it
C:\vcredist.exe /Q
After doing this, the executables starting working:
C:\ > cmd.exe /C "C:\mysql\bin\mysqld" --initialize-insecure
C:\ > cmd.exe /C "C:\mysql\bin\mysqld" --install
C:\ > start-service mysql
C:\ > cmd.exe /C "C:\mysql\bin\mysql" -u root

binary install in google container optimized OS

As it is the Linux version of OS, I tried firing, hoping that would work
apt-get install jq
But it says apt-get: command not found.
How I can install new binaries as I wanted to add some extra logic in the startup script which required few extra libs to be installed first.
Please correct me if I am doing anything wrong.
Container OS is locked down. You are prohibited from installing programs. Create a container and run the command in the container.
Container-Optimized OS does not include a package manager; as such,
you'll be unable to install software packages directly on an instance.
However, you can use CoreOS toolbox to install and run debugging and
admin tools in an isolated container.
Container-Optimized OS Overview
https://cloud.google.com/container-optimized-os/docs/how-to/toolbox
You can use toolbox to install the package
You can specify a startup script through the metadata server. The script would be run at boot time.

ModuleNotFoundError when running functional python tests despite that textX command works

I followed the set of instructions for this open source.
At step 3, I am supposed to run
py.test tests/functional/
When I do so, I get
ModuleNotFoundError: No module named 'textx'
However, when I type textx, it's definitely working as a command.
Where did I go wrong?
The PYTHONPATH is not set by py.test, see https://docs.pytest.org/en/latest/pythonpath.html#pythonpath
As described in https://github.com/igordejanovic/textX/blob/master/CONTRIBUTING.md you install textX in your virtual environment. If you omit 'pip install -e .' you get the described behavior.
As mentioned above, you can set the PYTHONPATH manually. Alternatively you can also run 'python -m pytest tests/functional' as proposed on the py.test website.
It is unclear to me why the textx command works in your example. Maybe you installed textX outside your virtual environment after creating the virtual environment?
Run export PYTHONPATH=. before running the py.test tests/functional/ and it should work.
This error may have occurred because I installed textX outside my virtual environment after creating the virtual environment.

MacPorts is unusable

I've recently installed MacPorts as explained on MacPorts website. All the process went well. The .profile file in my home directory has been updated (in this file the paths "/opt/local/bin" and "/opt/local/sbin" are added to the environment variable PATH) and all the macports files are in the directory "/opt". When I type "which port" in the shell, it returns "/opt/local/bin/port".
But something weird happens when I ask to install the port "octave-devel" (I've installed MacPorts to use Octave on my Mac in the first place). So when I enter the command "sudo port install octave-devel +atlas+docs" (as explained in GNU Octave wiki) in the terminal and type my password, the shell replies "Error: Port octave-devel not found". However the port "octave-devel" seems to exist because I've found its description on this page of the macports website.
Because I had to use Octave quickly I first wanted to uninstall MacPorts and install Fink instead and I tried the method described on the MacPorts website but after I typed "sudo port -fp uninstall installed" it returned "Error: No ports matched the given expression". I couldn't even uninstall this software! I really think that it is a problem of MacPorts itself and not the octave port but I can't find what exactly.
Eventually I used Octave on a Windows computer but it annoys me not to know what is wrong with MacPorts on my computer. And mainly, I want to be capable to use GNU Octave on my Mac because I need it for school.
Thank you in advance and happy holidays.
I'm not sure which version of OSX you are running, however, I have octave (not octave-devel) version 3.6.4 installed via macports on a machine running OSX 10.9.1. This was built using:
sudo port install octave
which yields a known bug building the atlas dependency that results from a missing fortran compiler. At this point you have two options. Before attempting to install octave first try to install atlas separately, either overriding the standard clang compiler with the gcc4x flag, or install atlas using:
sudo port install atlas +nofortran
which runs fine using clang. With atlas installed, octave should build to completion although there is a possibility that you will find an error regarding the use of arpack by apple as a vector library. Using +arpack is preferred, so it may be useful to load this by hand as well before starting your octave install.
Trying to install Octave using MacPorts I ran into a similar problem.
Summary
My solution was to first clean & build atlas separately using gcc47 instead of the default mpclang34. Then to build the default octave.
Details
This is on a MacBook running an older OS (10.7.5), the standard Octave (3.8.2) package failed to build - it hung on building the atlas dependency.
Solution:
sudo port clean atlas
sudo port -v install atlas +gcc48
sudo port -v install octave +atlas+docs
I'm currently going through the process of installing Octave via MacPorts. I used the following command which I found on Shifteleven.com:
sudo port install octave-devel +gcc45
It seems to be working so far. You also need to make sure you've installed the Xcode command line tools, which is something that I forgot to do the first time I tried.
I also ran into problems installing Octave using Macports on OSX 10.10.1 and solved them, similar to #Tom_N_PDX and #isak.
Short version
I got it working using one of the options described by #isak.
More detailed version
Running sudo port install octave failed because of the missing Fortran compiler problem.
I next installed Fortran using Macports sudo port install gcc48 and then tried re-installing Octave
sudo port clean octave
sudo port install octave
This "hung" on Atlas, as others have mentioned, although I now realize it just takes a long time and I killed it before it finished. Likely it would have worked, as the output said it had found Fortran
Selected C compiler: /usr/bin/clang
Selected F77 compiler: gfortran48
I then installed atlas separately, using the +gcc48 flag, as suggested by #isak
sudo port install atlas +gcc48
but it displayed the same compiler information as above (consistent with my conjecture that the above would have worked). This process took about 4 hours. You can monitor the progress of the task in the logfile (found with the command sudo port logfile atlas), which reassures you it's doing something and not "hung". (Oddly the output does halt mid-message, but it always eventually resumed. Also there were a lot of warning messages.)
Last, running the following worked:
sudo port clean octave
sudo port install +arpack
I actually first tried without the +arpack option and it worked but I got the following message, consistent with #isak's answer
WARNING: Dependency 'arpack' is installed with the +accelerate variant, using Apple's Vector Libraries which have some known bugs that can cause Octave to crash if using certain functions in arpack. The +atlas variant does not have these issues with Octave, but does take many hours to compile even on modern hardware.
When I reinstalled Octave with the +arpack flag it took less than a minute (because I had already installed Atlas).
I had a similar problem with MacPorts. I would recommend using HomeBrew instead. Here are the commands to install Octave on HomeBrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew upgrade
brew install octave