Skip to main content
Participating Frequently
Oct 21, 2021 2:15 PM UTC

Miniconda/Conda

Hello,
I tried to create  a new conda environment separate from the base. It failed as we don't have a support contract (and don't have access to the secure channel).
I activated the base environment to see if I could get a bit further.
bash-4.3$ conda activate base
(base) bash-4.3$
(base) bash-4.3$ conda info --envs
# conda environments:
#
base * /global/rocket/miniconda

(base) bash-4.3$ conda install -c https://conda.anaconda.org/zoss-appdev git
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/zoss-appdev/noarch/repodata.json>

Our z/OS LPAR doesn't have access to the internet.

How can I install the the package via conda without internet connectivity from z/OS?
Can I download the package to z/OS (internet to workstation to z/OS) and run conda install?

thanks

------------------------------
Gary Grossi
IT Director, Z Systems
Alight Solutions LLC
Lincolnshire IL United States
------------------------------

    15 replies

    Vladimir Ein
    Rocketeer
    Nov 17, 2021 1:21 PM UTC
    Hello Vladimir,
    Thanks for the quick response.

    It looks like bash 4.3.46 uses ibm-1047 when creating files compared to 4.3.48 using iso8859-1.

    [@02858@SYSA]$ git --version
    git version 2.14.4_zos_b09

    [@02858@SYSA]$ bash --version
    GNU bash, version 4.3.46(51)-release (i370-ibm-openedition)

    [@02858@SYSA]$ echo hello > G
    [@02858@SYSA]$ ls -T G
    t IBM-1047 T=on G

    --

    (base) bash-4.3$ git --version
    git version 2.26.2-78

    (base) bash-4.3$ bash --version
    GNU bash, version 4.3.48(2)-release (i370-ibm-openedition)

    (base) bash-4.3$ echo hello > GG
    (base) bash-4.3$ ls -T GG
    t ISO8859-1 T=on GG

    Question:
    How do I change the default behavior of bash so that it creates ibm-1047 encoded files?

    I am familiar with chtag  but most/all or our users are not.  In my opinion, it's easier and consistent to to use ibm-1047 as a default and let git do the conversion when/if needed. It also seems to correlate better with the rules in the .gitattributes file.


    cat .gitattributes
    # the pattern matching is done with the latest match in the file

    # default for text files
    * zos-working-tree-encoding=ibm-1047

    # git files (which must be ASCII or UTF-8)
    .gitattributes zos-working-tree-encoding=iso8859-1
    .gitignore zos-working-tree-encoding=iso8859-1

    # binary files
    *.jpg binary
    *.png binary
    *.gif binary
    *.zip binary
    #

    Thanks, Gary

    ------------------------------
    Gary Grossi
    IT Director, Z Systems
    Alight Solutions LLC
    Lincolnshire IL US
    ------------------------------
    Hello Gary,

    Encoding may differ depending on where you redirect your output. If you're writing to a file that already exists and is tagged, bash 4.3.48 will use the encoding of that file (as specified by its tag) instead of ISO8859-1.

    $ echo "123" > brand-new-file.txt
    $ touch pre-allocated-file.txt && chtag -tc 1047 pre-allocated-file.txt
    $ echo "123" > pre-allocated-file.txt

    $ ls -T
    t ISO8859-1 T=on brand-new-file.txt
    t IBM-1047 T=on pre-allocated-file.txt

    $ od -h brand-new-file.txt
    0000000000 31 32 33 0A
    0000000004

    $ od -h pre-allocated-file.txt
    0000000000 F1 F2 F3 15
    0000000004

    The od command shows that brand-new-file.txt is in ISO8859-1, whereas the tagged pre-existing file remains in IBM-1047.

    You can change the default output encoding using the environment variable _ENCODING_FILE_NEW like this:

    $ _ENCODE_FILE_NEW=IBM-1047 echo "123" > ebcdic-file.txt

    - or -

    $ export _ENCODE_FILE_NEW=IBM-1047
    $ echo "123" > ebcdic-file.txt

    Regards,
    Vladimir

    ------------------------------
    Vladimir Ein
    ------------------------------
    Participating Frequently
    Nov 17, 2021 5:51 PM UTC
    Hello Gary,

    Encoding may differ depending on where you redirect your output. If you're writing to a file that already exists and is tagged, bash 4.3.48 will use the encoding of that file (as specified by its tag) instead of ISO8859-1.

    $ echo "123" > brand-new-file.txt
    $ touch pre-allocated-file.txt && chtag -tc 1047 pre-allocated-file.txt
    $ echo "123" > pre-allocated-file.txt

    $ ls -T
    t ISO8859-1 T=on brand-new-file.txt
    t IBM-1047 T=on pre-allocated-file.txt

    $ od -h brand-new-file.txt
    0000000000 31 32 33 0A
    0000000004

    $ od -h pre-allocated-file.txt
    0000000000 F1 F2 F3 15
    0000000004

    The od command shows that brand-new-file.txt is in ISO8859-1, whereas the tagged pre-existing file remains in IBM-1047.

    You can change the default output encoding using the environment variable _ENCODING_FILE_NEW like this:

    $ _ENCODE_FILE_NEW=IBM-1047 echo "123" > ebcdic-file.txt

    - or -

    $ export _ENCODE_FILE_NEW=IBM-1047
    $ echo "123" > ebcdic-file.txt

    Regards,
    Vladimir

    ------------------------------
    Vladimir Ein
    ------------------------------
    Hello Vladimir,
    Thanks, the env variable solves the issue.

    Here is an example sequence of needing to run chtag:

    export _ENCODE_FILE_NEW=IBM-1047

    # file will not have a code page and be untagged
    touch file1
    - untagged T=off file1

    vi file1 and update
    m IBM-1047 T=off file1

    # vim has an issue with the file until it's tagged (chtag -t file1)
    vim file1


    If vim is used to update a newly touched file, the code set and tag are set properly. vi doesn't seem to do that.
    Is there way around that without chtag?

    Thanks again,
    Gary

    ------------------------------
    Gary Grossi
    IT Director, Z Systems
    Alight Solutions LLC
    Lincolnshire IL US
    ------------------------------
    Vladimir Ein
    Rocketeer
    Nov 26, 2021 6:54 AM UTC
    Hello Vladimir,
    Thanks, the env variable solves the issue.

    Here is an example sequence of needing to run chtag:

    export _ENCODE_FILE_NEW=IBM-1047

    # file will not have a code page and be untagged
    touch file1
    - untagged T=off file1

    vi file1 and update
    m IBM-1047 T=off file1

    # vim has an issue with the file until it's tagged (chtag -t file1)
    vim file1


    If vim is used to update a newly touched file, the code set and tag are set properly. vi doesn't seem to do that.
    Is there way around that without chtag?

    Thanks again,
    Gary

    ------------------------------
    Gary Grossi
    IT Director, Z Systems
    Alight Solutions LLC
    Lincolnshire IL US
    ------------------------------
    Hello Gary,

    Unfortunately that's the way vi works. It seems to be opening files in binary mode, which, combined with AUTOTAG flag in _CEE_RUNOPTS, produces files tagged as 'mixed contents'. Mixed-tag files are treated by most tools just like binary files; their contents is not converted from one encoding to another, which is reasonable for files containing binary data. Generally I'd recommend to avoid the 'mixed' tags as much as possible.

    You can deal with this multiple ways, none of them being very convenient though.

    1. Issue chtag right after touch to set the tag to the desired encoding. Tools that open the file will then honor and keep the tag.

    2. Issue chtag after vi, like you did.

    3. Disable autotagging for vi, by calling it like this:

    _CEE_RUNOPTS='FILETAG(AUTOCVT,NOAUTOTAG) POSIX(ON)' vi file1

    You can also define an alias for it.

    alias vi="_CEE_RUNOPTS='FILETAG(AUTOCVT,NOAUTOTAG) POSIX(ON)' vi"

    This way vi will keep the file untagged.

    I'm sure there are other workarounds, these just were first to come to my mind.

    Regards,
    Vladimir

    ------------------------------
    Vladimir Ein
    Software Engineer
    Rocket Software
    ------------------------------
    Participating Frequently
    Nov 28, 2021 3:39 PM UTC
    Hello Gary,

    Unfortunately that's the way vi works. It seems to be opening files in binary mode, which, combined with AUTOTAG flag in _CEE_RUNOPTS, produces files tagged as 'mixed contents'. Mixed-tag files are treated by most tools just like binary files; their contents is not converted from one encoding to another, which is reasonable for files containing binary data. Generally I'd recommend to avoid the 'mixed' tags as much as possible.

    You can deal with this multiple ways, none of them being very convenient though.

    1. Issue chtag right after touch to set the tag to the desired encoding. Tools that open the file will then honor and keep the tag.

    2. Issue chtag after vi, like you did.

    3. Disable autotagging for vi, by calling it like this:

    _CEE_RUNOPTS='FILETAG(AUTOCVT,NOAUTOTAG) POSIX(ON)' vi file1

    You can also define an alias for it.

    alias vi="_CEE_RUNOPTS='FILETAG(AUTOCVT,NOAUTOTAG) POSIX(ON)' vi"

    This way vi will keep the file untagged.

    I'm sure there are other workarounds, these just were first to come to my mind.

    Regards,
    Vladimir

    ------------------------------
    Vladimir Ein
    Software Engineer
    Rocket Software
    ------------------------------
    Hello Vladimir,
    I like the alias approach with disabling autotagging.

     Do you think IBM would respond to a customer enhancement request to have vi behave like vim (default to IBM-1047 and T=on) ?

    Thanks for the response...much appreciated.
    Gary

    ------------------------------
    Gary Grossi
    IT Director, Z Systems
    Alight Solutions LLC
    Lincolnshire IL US
    ------------------------------
    Vladimir Ein
    Rocketeer
    Dec 2, 2021 5:39 AM UTC
    Hello Vladimir,
    I like the alias approach with disabling autotagging.

     Do you think IBM would respond to a customer enhancement request to have vi behave like vim (default to IBM-1047 and T=on) ?

    Thanks for the response...much appreciated.
    Gary

    ------------------------------
    Gary Grossi
    IT Director, Z Systems
    Alight Solutions LLC
    Lincolnshire IL US
    ------------------------------
    Hello Gary,

    I don't know what IBM's policy is regarding updates to these built-in USS tools (vi and others). The only way to find out is probably to try and open an enhancement request.

    Regards,
    Vladimir

    ------------------------------
    Vladimir Ein
    Software Engineer
    Rocket Software
    ------------------------------